tags:

views:

40

answers:

1

Hello,

i have some truetype fonts and a programm takes these fonts so that a user can select a font he like to put some symbols around. The programm save these information (which font name und character code) in a file. (I dont have the source of this programm)

Now i have to reed these file into another programm (vb.net) and get the character from the character code. And here comes the problem.

If i'll try chr(144) i'll get an empty char back ... but in the font which the user has selected befor, the character, which display a symbol, exists with the character ç.

Have i to load the font on runtime or what i have to?

I have tried already CharW(144) but with the same result: I'll get an empty char but i need to get the ç

Kind regards Nico

+1  A: 

According to the Extended Latin-1 code chart, ç is U+00E8 (232 in decimal) so I suggest you try ChrW(232).

The value returned by Chr depends on the current thread's default encoding (and I seem to remember it's possible to provoke some odd results) - I would try to avoid it if possible. If you know the encoding you need to use, then use it explicitly with Encoding.GetString etc. Otherwise, stick to Unicode values wherever possible.

Jon Skeet
The ç character was just an example. So there will be other character codes i can't transform with chr() or chrW(). Other ideas?
Nico
You need to know the encoding that the other program was using. Without that information, the character codes are pretty much meaningless - it's like having an encrypted file without the key.
Jon Skeet
With "to know the encoding of the other programm" you mean to know what font the other programm use? Sorry but this is the first time i have to mess with somethink like convert charcodes to the charater and so on.
Nico
No, not the font - the encoding. The encoding is what determines what value translates to which Unicode character. See http://pobox.com/~skeet/csharp/unicode.html
Jon Skeet
ok ... i have tried each Encoding.getEncoding(latin1,2,3,5,utf8,unicode,28591,1250,28605).getString but nothing returned the right character, what else can i do?
Nico
Hmm... that does sound very odd. Is it only in this font that it's meant to display a ç? Can you load that font into charmap and find out whether it's mapped to some different Unicode character for some reason? Do you have any more information about what these "character codes" are meant to be?
Jon Skeet
Hey, i got it ... the fonts was used the macintosh roman so i have to use codepage 10000. after that i've got the right characters
Nico
Excellent - glad that sorted it :)
Jon Skeet