Re: [fpc-pascal] Concatenating CP Strings

2018-09-15 Thread Martok
> Setting the code page of a file tells the RTL about the encoding of the > strings in the file. The string's static code page (which maps to > DefaultSystemCodePage if none is specified) tells the compiler to which > encoding this string data should be converted. I know! That doesn't make it

Re: [fpc-pascal] Concatenating CP Strings

2018-09-15 Thread Jonas Maebe
On 15/09/18 22:32, Martok wrote: Gah, accidentally removed the comment that said what the actual problem is ;-) ReadLn(f, s); WriteLn(StringCodePage(s)); That prints 1252, which is the DefaultSystemCodePage. At that point, information loss has already occured, there is no way to fix the

Re: [fpc-pascal] Concatenating CP Strings

2018-09-15 Thread Martok
Gah, accidentally removed the comment that said what the actual problem is ;-) > ReadLn(f, s); > WriteLn(StringCodePage(s)); That prints 1252, which is the DefaultSystemCodePage. At that point, information loss has already occured, there is no way to fix the CP in user code. I would expect re

Re: [fpc-pascal] Concatenating CP Strings

2018-09-15 Thread Martok
And another one: var f: TextFile; s: string; begin AssignFile(f, 'a_file.txt'); SetTextCodePage(f, 866); Reset(f); ReadLn(f, s); WriteLn(StringCodePage(s)); readln; end. That is rather useless... Writing anything into the specified codepage works perfectly fine. -- Regards, M

Re: [fpc-pascal] Concatenating CP Strings

2018-09-15 Thread Martok
Am 15.09.2018 um 07:34 schrieb Mattias Gaertner via fpc-pascal: > To have the result in a specific codepage use > SetCodePage(result,NeededCP,true); As I wrote, doing this by hand works, but I don't want to believe somebody thought that was how it should be. Why would "CP_UTF16 + CP_UTF8(literal) =