[fpc-pascal] Re: International chars and Codepages...

Tomas Hajny XHajT03 at mbox.vol.cz
Tue Aug 29 18:48:33 CEST 2006


Jonas Maebe wrote:
> 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




More information about the fpc-pascal mailing list