Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Coding or Decoding strings?
Message
From
08/09/2014 09:24:31
 
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows XP SP3
Network:
Windows XP
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01607130
Message ID:
01607161
Views:
38
>>Thanks for the detailed answer. Maybe I was not precise enough in describing
>>the problem. My app (VB.NET/VS2010) uses external datasources (data from cd and a webservice)
>>which return string coded in (I believe) 1252. when I display or save these strings in my vb-programm
>>all special german or french characters (like öäü or ß) are lost. And i believe this happens because these
>>data is encoded on !251 and must betransformed to UTF?
>>
>>Best regards
>
>If you have a byte array from CP1252 try:
        public static string Convert(Byte[] bytes)
>        {
>            Encoding cp1252 = Encoding.GetEncoding(1252);
>            Encoding utf16 = Encoding.Unicode;
>           
>            Byte[] result = Encoding.Convert(cp1252, utf16, bytes);
>            return Encoding.Unicode.GetString(result);
>        }
or maybe just
return  Encoding.GetEncoding(1252).GetString(bytes);
:=}
Previous
Reply
Map
View

Click here to load this message in the networking platform