Lazarus

Programming => General => Topic started by: @Func on January 15, 2020, 01:13:10 am

Title: Unicode display issue
Post by: @Func on January 15, 2020, 01:13:10 am
dear friend

I'm using utf8decode function to decode chinese in order to display it . It's worked in windows operation system. but in linux it 's display ??????, Does it mean linux has different decode function? can you give me some suggestion.
Title: Re: Unicode display issue
Post by: winni on January 15, 2020, 01:38:25 am
Hi!

Where it does display ?????? 

In an application?
In the console?
In a terminal ?

Winni
Title: Re: Unicode display issue
Post by: @Func on January 15, 2020, 01:45:07 am
Hi!

Where it does display ?????? 

In an application?
In the console?
In a terminal ?

Winni

Both log file and writeln in console

  {$IFDEF WriteLnFun}
  if FMemo <> nil then
    FMemo.Add(utf8decode(msg))
  else
    WriteLine(utf8decode(msg));
  {$Endif}
    //FMemo.Add(utf8decode(msg));
  {$IFDEF WriteInfoFileFun}
  writeWorkLog('{Info}:'+DateTimeToStr(now())+':'+ msg);
  {$ENDIF}     

the logs is just like this as follow
14-1-20 23:47:43 Log: {Info}:14-1-20 23:47:43:Read parameter  ?????? - ????????? value 0 address 1 unit 1
14-1-20 23:47:44 Log: {Info}:14-1-20 23:47:44:Read parameter  ?????? - ??????? value 0 address 1 unit 1
Title: Re: Unicode display issue
Post by: winni on January 15, 2020, 02:09:44 am
Hi!

In the editor: Place your cursot on UTFdecode. Press F1   :

Code: Text  [Select][+][-]
  1. UTF8Decode converts the UTF-8 encoded ansistring S to a unicodestring and returns the resulting string. It calls the low-level Utf8ToUnicode function to do the actual work.

Is it that what you want? I don't think so.

Lazarus works now with UTF8. By default.

Winni
TinyPortal © 2005-2018