<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Write file in unicode</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/3608e375a7/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/3608e375a7/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/3608e375a7/</id><updated>2020-02-27T14:18:56.475000Z</updated><subtitle>Recent posts to Write file in unicode</subtitle><entry><title>Write file in unicode</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/3608e375a7/?limit=25#fa31" rel="alternate"/><published>2020-02-27T14:18:56.475000Z</published><updated>2020-02-27T14:18:56.475000Z</updated><author><name>alm</name><uri>https://forge.codesys.com/u/alm/</uri></author><id>https://forge.codesys.comd2c147c3c3e47f3e0d05545a599ed0ca8752f0e2</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;e.kislov hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
So you have file with UTF8 charset?&lt;br/&gt;
Try to use StringUtils library, function ConvertUTF8ToUTF16.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I didn't know that such a thing existed. &lt;br/&gt;
I'm going to try it later. &lt;br/&gt;
Thanks.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Write file in unicode</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/3608e375a7/?limit=25#33e2" rel="alternate"/><published>2020-02-27T14:18:56.011000Z</published><updated>2020-02-27T14:18:56.011000Z</updated><author><name>e.kislov</name><uri>https://forge.codesys.com/u/e-kislov/</uri></author><id>https://forge.codesys.com6a002555b22c1d63766e3417f5e33a4743fa356c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;So you have file with UTF8 charset?&lt;br/&gt;
Try to use StringUtils library, function ConvertUTF8ToUTF16.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Write file in unicode</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/3608e375a7/?limit=25#a27f" rel="alternate"/><published>2020-02-27T14:18:54.887000Z</published><updated>2020-02-27T14:18:54.887000Z</updated><author><name>alm</name><uri>https://forge.codesys.com/u/alm/</uri></author><id>https://forge.codesys.com8ac55e04d71287e6f94b427f13c628349d706abf</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;e.kislov hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Which  value? ("something like 20 thousand...")&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Well I already found the problem but the exact value was 26721(WORD). I found out that it was utf-8 so it was reading it 1 byte at a time but into a WSTRING of which every char is a 16bit WORD and it also was not utf-8, the encoding was ISO 8859-1 / latin1, which means all the other chars than the ascii (0-127) are not encoded correctly. 26721 in hex is 6861 which corresponds to the letters h(68) a(61). &lt;/p&gt;
&lt;p&gt;So my problem still stands, I can't display those characters. 0-127 works just fine.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Write file in unicode</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/3608e375a7/?limit=25#3603" rel="alternate"/><published>2020-02-27T14:18:54.497000Z</published><updated>2020-02-27T14:18:54.497000Z</updated><author><name>e.kislov</name><uri>https://forge.codesys.com/u/e-kislov/</uri></author><id>https://forge.codesys.com6b9eb70f3daf2235a180a0672786f5ebfe677e42</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Which &lt;strong&gt;exact&lt;/strong&gt; value? ("something like 20 thousand...")&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Write file in unicode</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/3608e375a7/?limit=25#2863" rel="alternate"/><published>2020-02-27T14:18:54.094000Z</published><updated>2020-02-27T14:18:54.094000Z</updated><author><name>alm</name><uri>https://forge.codesys.com/u/alm/</uri></author><id>https://forge.codesys.come6097e67937d89200cab694347593229c2f0b3a9</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;e.kislov hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
There is no problem, just use WSTRING type and &lt;a class="" href="https://en.wikipedia.org/wiki/Byte_order_mark" rel="nofollow"&gt;byte ordermark&lt;/a&gt;.&lt;br/&gt;
Library writes not ANSI or Unicode or something else, library just writes data.&lt;br/&gt;
uni1.png&lt;br/&gt;
uni2.png&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Well, that was for writing. But what would I do if i want to read unicode from the file?&lt;br/&gt;
If I do ```&lt;/p&gt;
&lt;p&gt;SysFileRead(hFile:=FileHandle, pbyBuffer:=ADR(wsData), 2 * TO_DWORD(Standard64.WLEN(wsData)), pResult:=pResult);&lt;/p&gt;
&lt;p&gt;``` my wsData =&amp;gt; WSTRING(255) gets totally wrong numbers. ex. for the letter 'h'(hex 68) i get something like 20 thousand which can't be converted back to the letter 'h' from ASCII ... what am I doing wrong??&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Write file in unicode</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/3608e375a7/?limit=25#982a" rel="alternate"/><published>2020-02-27T14:18:52.845000Z</published><updated>2020-02-27T14:18:52.845000Z</updated><author><name>cerminek</name><uri>https://forge.codesys.com/u/cerminek/</uri></author><id>https://forge.codesys.com21c969d1d4b907f76c5b223a9419761869feb74f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;e.kislov hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
There is no problem, just use WSTRING type and &lt;a class="" href="https://en.wikipedia.org/wiki/Byte_order_mark" rel="nofollow"&gt;byte ordermark&lt;/a&gt;.&lt;br/&gt;
Library writes not ANSI or Unicode or something else, library just writes data.&lt;br/&gt;
uni1.png&lt;br/&gt;
uni2.png&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Thanks a lot for this solution!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Write file in unicode</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/3608e375a7/?limit=25#a148" rel="alternate"/><published>2020-02-27T14:18:52.366000Z</published><updated>2020-02-27T14:18:52.366000Z</updated><author><name>e.kislov</name><uri>https://forge.codesys.com/u/e-kislov/</uri></author><id>https://forge.codesys.com0fad207730d7d1238a7a3637bb93e6ce0b6711ac</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;There is no problem, just use WSTRING type and &lt;a class="" href="https://en.wikipedia.org/wiki/Byte_order_mark" rel="nofollow"&gt;byte ordermark&lt;/a&gt;.&lt;br/&gt;
Library writes not ANSI or Unicode or something else, library just writes data.&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: uni1.png" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=4226"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="IMG: uni2.png" rel="nofollow" src="https://forum.codesys.com//download/file.php?id=4227"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Write file in unicode</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/3608e375a7/?limit=25#7b72" rel="alternate"/><published>2020-02-27T14:18:51.918000Z</published><updated>2020-02-27T14:18:51.918000Z</updated><author><name>cerminek</name><uri>https://forge.codesys.com/u/cerminek/</uri></author><id>https://forge.codesys.com20618acad50db2197392cebc0d668afb078aa714</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Massimo.Milluzzo hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Hi all,&lt;br/&gt;
I'm trying to write a file with the SysFile library. How can I write unicode characters? It seems the library writes only in ANSI.&lt;br/&gt;
Thank you,&lt;br/&gt;
Regards.&lt;br/&gt;
Massimo&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Hi, I'm intereste in this too. I've made a lot research on it and no CoDeSys based device were able to save file in unicode. Only ANSI... But I've used Festo PLC, which uses Linux RT and the files saved on SD card by SysLibFile were in UTF-8...&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Write file in unicode</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/3608e375a7/?limit=25#2069" rel="alternate"/><published>2020-02-27T14:18:50.727000Z</published><updated>2020-02-27T14:18:50.727000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com214874606f95e72d890b53d3e90a903c7afb10be</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; Massimo.Milluzzo&lt;/p&gt;
&lt;p&gt;Hi all,&lt;br/&gt;
I'm trying to write a file with the SysFile library. How can I write unicode characters? It seems the library writes only in ANSI.&lt;/p&gt;
&lt;p&gt;Thank you,&lt;br/&gt;
Regards.&lt;br/&gt;
Massimo&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>