Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Data Corruption Issues
 Unable to translate Unicode character

Author  Topic 

SP
Starting Member

2 Posts

Posted - 2012-03-01 : 11:02:37
I got this error when I tried to connect a gridview to a sqldatasource using visual web developer. I've been building a website for months on a stand alone computer with sql srvr 08 express and VWD without any issues until now when I got the below error. Can anyone help?
Unable to translate Unicode character \uD8FF at index 0 to specified code page.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Text.EncoderFallbackException: Unable to translate Unicode character \uD8FF at index 0 to specified code page.

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[EncoderFallbackException: Unable to translate Unicode character \uD8FF at index 0 to specified code page.]
System.Text.EncoderExceptionFallbackBuffer.Fallback(Char charUnknown, Int32 index) +155
System.Text.EncoderFallbackBuffer.InternalFallback(Char ch, Char*& chars) +275
System.Text.UTF8Encoding.GetByteCount(Char* chars, Int32 count, EncoderNLS baseEncoder) +7680574
System.Text.UTF8Encoding.GetByteCount(String chars) +43
System.IO.BinaryWriter.Write(String value) +38
System.Web.UI.ObjectStateFormatter.SerializeValue(SerializerBinaryWriter writer, Object value) +1281

[ArgumentException: Error serializing value '?????Aa???????*D
EdGÐ
IE EJelI in?R? ? U? ? ? ?U? F? ? ? ? ? ? ?†††††???N??????II?????†????????????8d????? ?? 2?? ??????? ? ?^?
???? ? ? Y?˜??????? ??? C? ?? ??????
?#
?????????8?????????8

s
??n?* ? n O
RTUU
z? ?(????
|?a?u? ??�A????A?? ??� ?
¨???R?????††††??†??†???E????†††††††††† ††††††††† ??†††† ??††††dd????††† ????????????† a E?e;I ? ††††††††††††††††††††††††††††††††††††††††††††††††††††††††††† a E?e?I ? ?? ?II???????????????????????????????????U??????????????????????????????????x???d?!?#162;AaaaA^...' of type 'System.String.']
System.Web.UI.ObjectStateFormatter.SerializeValue(SerializerBinaryWriter writer, Object value) +3319
System.Web.UI.ObjectStateFormatter.Serialize(Stream outputStream, Object stateGraph) +110
System.Web.UI.ObjectStateFormatter.Serialize(Object stateGraph) +57
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Serialize(Object state) +4
System.Web.UI.Util.SerializeWithAssert(IStateFormatter formatter, Object stateGraph) +37
System.Web.UI.HiddenFieldPageStatePersister.Save() +79
System.Web.UI.Page.SavePageStateToPersistenceMedium(Object state) +105
System.Web.UI.Page.SaveAllState() +236
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1099

SP
Starting Member

2 Posts

Posted - 2012-03-07 : 10:28:18
I have found the problem and solved it. The error came when I was attempting to write some code that would store an image path that should have looked like this: ~/Images/nameofimage.bmp using a data type of nvarchar(max). Instead it created a bunch of rectangles and foreign characters (??????? Aa) that the unicode could not translate hence causing the error.
So the entire problem was based in the database table due to some improper code on my part that caused/allowed some odd characters to be stored in the table where the Unicode character could not be translated. I deleted the row in the table and everything is working correctly again now.
Go to Top of Page
   

- Advertisement -