[Lazarus] Feature Request: Insert {codepage UTF8} per default

Michael W. Vogel m-w-vogel at gmx.de
Wed Mar 30 14:12:37 CEST 2016


Am 30.03.2016 um 13:02 schrieb Juha Manninen:
> Conversions in your testproject may work, but you ignored the forum 
> link I gave earlier. There "malcome" gave examples that fail. 
I don't ignored it, but I'm not so fast to test the examples there. I'll 
try the examples there for myself with and without the codepage 
definition. Thanks for that link.


Am 30.03.2016 um 13:02 schrieb Juha Manninen:
> BTW, the hack is not made by LCL but by LazUtils which can be used 
> also with cmd line / server programs. 
You are right. I only use LazUtils in combination with the component 
library, my mistake. Thanks for clearing this.


Am 30.03.2016 um 13:02 schrieb Juha Manninen:
>> I also don't want it. I want a added {$codepage UTF8}, if the file is 
>> saved as a UTF-8 encoded one. 
> The cases fail with UTF-8 file encoding.
I don't understand this.


Am 30.03.2016 um 13:02 schrieb Juha Manninen:
> The issue with constant string encodings is more complex than you seem
> to understand.
Thats true and I've made dozens of tests and spend a lot of time and try 
to help other people with it ...


Am 30.03.2016 um 13:02 schrieb Juha Manninen:
> It is explained here somehow:
>    http://wiki.freepascal.org/Better_Unicode_Support_in_Lazarus#String_Literals
And the first example there is wrong (or the words "and without" need to 
be removed). With no defined codepage
const s: string = 'äöü';
has codepoints of a UTF-8 String, the codepage is 0. If you assign it to 
a string with a declared codepage, you get a corrupted string. See my 
example.


BTW I've forgotten ShortStrings in my example and maybe PChar. I'll add 
it (if possible) and try and report later.

Thanks for your attention and time

Kindly regards

Michl




More information about the Lazarus mailing list