Recent

Author Topic: UTF8 on Linux  (Read 2672 times)

skiy1337lazarus

  • New Member
  • *
  • Posts: 34
UTF8 on Linux
« on: September 22, 2015, 09:02:28 am »
To get UTF8 conversion in FPC 3, I have to use UTF8Encode.
It seems that normal assignment just returns question marks ??????
procedure QuestionMarks(W:WideString);var
U:UTF8String;//same result with AnsiString
begin
U:=W;
writeln(U)
end;

My computer's locale:
 LANG=en_ZA.UTF-8

I just feel that FPC could do a better job here, since conversion is from UTF16 to UTF8.

I understand there is the "iconv" library....

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: UTF8 on Linux
« Reply #1 on: September 22, 2015, 10:53:34 am »
To get UTF8 conversion in FPC 3, I have to use UTF8Encode.
It seems that normal assignment just returns question marks ??????
do you have either cwstring or fpwidestring in the uses clause?

skiy1337lazarus

  • New Member
  • *
  • Posts: 34
Re:cwstring
« Reply #2 on: September 22, 2015, 11:43:28 am »
Thank you. Adding cwstring to my uses clause fixed the problem.

 

TinyPortal © 2005-2018