Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ C++/CLI C
Hello ,

I have a Datasetconatins data in greek character set for e.g.
Πριγκηποννήσου
Κομνηνών
Komninon
Διαγόρα
Diagora
Καλλιόπης
Kalliopis
Πάροδος Νίκαιας
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.

Thanks,
Sachin
Posted 27-Dec-12 21:38pm
Comments
Sergey Alexandrovich Kryukov at 28-Dec-12 2:53am
   
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.
 
—SA
Sergey Alexandrovich Kryukov at 28-Dec-12 3:02am
   
I see. Just use a tiny bit of logic...
—SA

1 solution

Rate this: bad
good
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.
 
—SA
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 450
1 OriginalGriff 230
2 DamithSL 150
3 Dave Kreskowiak 110
4 Suvendu Shekhar Giri 110
0 OriginalGriff 7,740
1 DamithSL 5,644
2 Sergey Alexandrovich Kryukov 5,404
3 Maciej Los 5,011
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2014
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