> 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
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
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
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
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) =