Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2006-08

Re: International chars and Codepages...

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

S.Anıl Yılmaz

Rimgaudas said,

> 2) use unicode (UTF-8) enabled editor instead of FP. Any windows editor will fit too.

I solved the problem, sort of. :-) In your previous post, you had suggested that I might be using FPIDE, and codepage clash between it and Windows would lead to
such a problem. I was using Scite as my IDE in both Windows and Linux, and it had been setup to use UTF8 already. Then I thought, "What if I use FPIDE instead of Scite?" and voila. The same code, produced perfect result in Windows. (Not tried Linux yet) Turkish characters appeared fine now. (FPC 202)

Thank you.
Anil

Jonas Maebe
to S.Anıl Yılmaz
S.Anıl Yılmaz wrote 8 lines
I solved the problem, sort of. :-) In your previous post, you had suggested that I might be using FPIDE, and codepage clash between it and Windows would lead to such a problem. I was using Scite as my IDE in both Windows and Linux, and it had been setup to use UTF8 already. Then I thought, "What if I use FPIDE instead of Scite?" and voila. The same code, produced perfect result in Windows. (Not tried Linux yet) Turkish characters appeared fine now. (FPC 202)

The reason is that FPIDE probably uses the current console code page. The proper way would probably be to save your source in utf-8 and installing a widestring manager which converts from utf-8 to the current console code page. I don't know how to do that though.

Jonas

Tomas Hajny
to Jonas Maebe
Jonas Maebe wrote 15 lines
On 29 aug 2006, at 14:56, S.Anől Yőlmaz wrote: > I solved the problem, sort of. :-) In your previous post, you had > suggested that I might be using FPIDE, and codepage clash between > it and Windows would lead to > such a problem. I was using Scite as my IDE in both Windows and > Linux, and it had been setup to use UTF8 already. Then I thought, > "What if I use FPIDE instead of Scite?" and voila. The same code, > produced perfect result in Windows. (Not tried Linux yet) Turkish > characters appeared fine now. (FPC 202) The reason is that FPIDE probably uses the current console code page. The proper way would probably be to save your source in utf-8 and installing a widestring manager which converts from utf-8 to the current console code page. I don't know how to do that though.

I do - at least partly. ;-) There are two issues there:

1) You must differentiate between different internally used ways how to store Unicode characters. Especially, you need to ensure that UTF-8 source is translated to a "proper" widestring during compilation.

2) You need to know the charset used for video output and translate on the fly where needed. The notorious "Video unit rewrite" (still unfinished because of other activities like release coordination ;-) ) is supposed to provide such a possibility (together with an option to use regular Write(Ln) after incorporating the rewritten unit Crt).

Tomas