Recent

Author Topic: Unicode display issue  (Read 194 times)

@Func

  • New Member
  • *
  • Posts: 33
Unicode display issue
« 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.

winni

  • Hero Member
  • *****
  • Posts: 721
Re: Unicode display issue
« Reply #1 on: January 15, 2020, 01:38:25 am »
Hi!

Where it does display ?????? 

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

Winni

@Func

  • New Member
  • *
  • Posts: 33
Re: Unicode display issue
« Reply #2 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

winni

  • Hero Member
  • *****
  • Posts: 721
Re: Unicode display issue
« Reply #3 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