Click here to Skip to main content
13,259,976 members (46,820 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hello ,

I have a Datasetconatins data in greek character set for e.g.
Πάροδος Νίκαιας
Parodos Nikaias

Which got converted to ??????? while saving from C# string object to unsigned char in C.

Same issue with Russian language.

Please suggest some thoughts on the same.

Posted 27-Dec-12 21:38pm
There is no differences between languages, in this respect. .NET itself uses Unicode. It never looses any text data, you do. There are many ways to screw up things, including Unicode text. You need to show some code sample manifesting your problem, if you need help.

In the meanwhile, I tell you: use only Unicode and Unicode UTFs for encoding (typically UTF-8), and nothing else. This is the key.

I see. Just use a tiny bit of logic...

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I just noticed: you say that you save the text in C unsigned char. What do you want then?!

Unicode code points in the subset covering Greek and Russian require up to 16 bits per character. The Unicode subset of first 216 code points is called Base Multilingual Plane. Other code points require more then 16 bits, which is also supported by Unicode. All Unicode UTFs support full set of code points; usually it's UTF-8, UTF-16 and, rarely, UTF-32. (No, UTF-8 does not mean 8 bit per character; UTF-16 does not mean 16 bits per characters; character size is variable.) Internally, .NET represents strings as UTF-16LE.

C char is only 8 bits. No way. Do something more reasonable. Forget about your legacy 8-bit encodings, they are gone.

If you have a particular problem, feel free to ask a follow-up question.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.171114.1 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100