Re: Unable to translate Unicode character \u00E9 at index 5409 to specified code page.

Tech-Archive recommends: Fix windows errors by optimizing your registry



Les Caudle wrote:
I've got some C# 2.0 code that has been working for a year.

using (XmlWriter w = XmlWriter.Create("out.xml" ,settings)) {
// many lines of code to write to w w.WriteStartElement("contactTypeRef");

Suddently, I'm getting this 100% repeatable error:

************** Exception Text **************
System.Text.EncoderFallbackException: Unable to translate Unicode character
\u00E9 at index 5409 to specified code page.
at System.Text.EncoderExceptionFallbackBuffer.Fallback(Char charUnknown,
Int32 index)
at System.Xml.CharEntityEncoderFallbackBuffer.Fallback(Char charUnknown,
Int32 index)
at System.Text.EncoderFallbackBuffer.InternalFallback(Char ch, Char*& chars)
at System.Text.ASCIIEncoding.GetBytes(Char* chars, Int32 charCount, Byte*
bytes, Int32 byteCount, EncoderNLS encoder)
at System.Text.EncoderNLS.Convert(Char* chars, Int32 charCount, Byte* bytes,
Int32 byteCount, Boolean flush, Int32& charsUsed, Int32& bytesUsed, Boolean&
completed)
at System.Text.EncoderNLS.Convert(Char[] chars, Int32 charIndex, Int32
charCount, Byte[] bytes, Int32 byteIndex, Int32 byteCount, Boolean flush, Int32&
charsUsed, Int32& bytesUsed, Boolean& completed)
at System.Xml.XmlEncodedRawTextWriter.EncodeChars(Int32 startOffset, Int32
endOffset, Boolean writeAllToStream)
at System.Xml.XmlEncodedRawTextWriter.FlushBuffer()
at System.Xml.XmlEncodedRawTextWriter.RawText(Char* pSrcBegin, Char* pSrcEnd)
at System.Xml.XmlEncodedRawTextWriter.RawText(String s)
at System.Xml.XmlEncodedRawTextWriter.WriteStartElement(String prefix, String
localName, String ns)
at System.Xml.XmlWellFormedWriter.WriteStartElement(String prefix, String
localName, String ns)
at System.Xml.XmlWriter.WriteStartElement(String localName)
I thought the whole point of using an XmlWriter was that it would translate the
chars into legal XML.

Are you perhaps trying to write out XML in an encoding like US-ASCII that does not include the character 'é'?
What are you XmlWriterSettings exactly when you get that error?


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
.



Relevant Pages

  • "Access is denied" error when trying to create subweb with certain templates
    ... subwebs of certain templates using code. ... bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& ... String listUrlName) ... OperationFinished finishOperation, Boolean throwExceptionOnFailure) ...
    (microsoft.public.sharepoint.portalserver.development)
  • Re: Central administration not working after upgrading MOSS 2007 to RTM.
    ... result, String methodName, Boolean sendToPipe) ... textReader, Int32 commandTimeout) ... connectionString, SqlFile sqlFileId, String sqlSignaturePath, ... newDatabaseId, String strDatabaseServer, String strDatabaseName, String ...
    (microsoft.public.sharepoint.portalserver)
  • Re: ExtendedDataGrid
    ... g, Rectangle bounds, CurrencyManager source, Int32 rowNum, Brush backBrush, ... Brush foreBrush, Boolean alignToRight)" String ...
    (microsoft.public.dotnet.languages.vb)
  • SqlException when configuring server farm in MOSS 2007
    ... exception, Boolean breakConnection) ... textReader, Int32 commandTimeout) ... connectionString, SqlFile sqlFileId, String sqlSignaturePath, ... newDatabaseId, String strDatabaseServer, String strDatabaseName, String ...
    (microsoft.public.sharepoint.portalserver)
  • migration from beta2 to trm, login error...
    ... System.Data.SqlClient.SqlDataReader.ReadColumn(Int32 i, Boolean ... username, Boolean updateLastLoginActivityDate, Int32& status, String& ... System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) ...
    (microsoft.public.dotnet.framework.aspnet)