Recent

Author Topic: [solved] problem concatenating utf8string (sent with zmq)  (Read 2153 times)

cpicanco

  • Hero Member
  • *****
  • Posts: 674
  • Behavioral Scientist and Programmer
    • Portfolio
[solved] problem concatenating utf8string (sent with zmq)
« on: November 22, 2016, 10:17:50 pm »
Hi,

I am sending some strings such as:

ã, á, é

over the network using zeromq. Zeromq expects utf8strings. Typecast did not work:

UTF8string(ã)

Any suggestions on how to fix this??


PS.: Sorry, but this requires some clarification. The problem is nothing related to send-receive. Sorry again.

Hi,

I am sending some strings such as:

ã, á, é

over the network using zeromq. Zeromq expects utf8strings and everything is ok sending and receiving them. However, I think I am concatenating them wrongly:

Code: Pascal  [Select][+][-]
  1. Caption := Utf8String1 +'ã';
Returns a caption with strange characters.

Any suggestions on how to fix this??

Edit.:

Found a solution:

Code: Pascal  [Select][+][-]
  1.  Button1.Caption := Utf8String1+SysToUtf8('ã');


« Last Edit: November 22, 2016, 10:59:53 pm by cpicanco »
Be mindful and excellent with each other.
https://github.com/cpicanco/

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4712
  • I like bugs.
Re: problem concatenating utf8string (sent with zmq)
« Reply #1 on: November 22, 2016, 11:00:23 pm »
You forgot to mention your FPC and Lazarus versions.
The concatenation is correct if the encoding of Utf8ZMQString1 is UTF-8 and you use the new default UTF-8 system in Lazarus.
Please read this:
 http://wiki.freepascal.org/Better_Unicode_Support_in_Lazarus
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

cpicanco

  • Hero Member
  • *****
  • Posts: 674
  • Behavioral Scientist and Programmer
    • Portfolio
Re: [solved] problem concatenating utf8string (sent with zmq)
« Reply #2 on: November 23, 2016, 01:00:36 am »
Thank you JuhaManninen. Will take a look. My actual version is 1.6. But I will move to 1.6.2 right now.
Be mindful and excellent with each other.
https://github.com/cpicanco/

cpicanco

  • Hero Member
  • *****
  • Posts: 674
  • Behavioral Scientist and Programmer
    • Portfolio
Re: [solved] problem concatenating utf8string (sent with zmq)
« Reply #3 on: November 23, 2016, 01:23:40 am »
For string literals inside constants SystToUTF8 have no effect. So, issue persists, partially.

Further, with -FcUTF8, project will not compile with errors "string type expected" at chars such 'à' 'ã' 'é'.

In my case I am getting erros inside case statements.

Code: Pascal  [Select][+][-]
  1. case S of
  2.  
  3. 'à' : Do something later;
  4. 'ã' : Do it now;
  5.  
  6. end;
Be mindful and excellent with each other.
https://github.com/cpicanco/

 

TinyPortal © 2005-2018