<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Generate and Write unicode characters to file in LabVIEW</title>
    <link>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045481#M868024</link>
    <description>&lt;P&gt;You should probably give &lt;A href="https://decibel.ni.com/content/docs/DOC-10153" target="_self"&gt;this page&lt;/A&gt;&amp;nbsp;a thorough read if you are intending on using Unicode in your application. &amp;nbsp;Here is a&amp;nbsp;relevant excerpt:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;ASCII technically only defines a 7-bit value and can accordingly represent 128 different characters including control characters such as newline (0x0A) and carriage return (0x0D). However ASCII characters in most applications including LabVIEW are stored as 8-bit values which can represent 256 different characters. The additional 128 characters in this extended ASCII range are defined by the operating system code page aka "Language for non-Unicode Programs".&amp;nbsp; For example,&lt;STRONG&gt; on a Western system, Windows defaults to the character set defined by the Windows-1252 code page.&lt;/STRONG&gt; Windows-1252 is an extension of another commonly used encoding called ISO-8859-1.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://en.wikipedia.org/wiki/Windows-1252" target="_self"&gt;Windows-1252&lt;/A&gt;&amp;nbsp;gives you characters up to 0xFF (ÿ) but not anything greater than 8-bits (e.g. no 0x0100). &amp;nbsp;By default&amp;nbsp;LabVIEW &lt;SPAN style="text-decoration: line-through;"&gt;only supports these 8-bit characters&lt;/SPAN&gt;&amp;nbsp;uses multi-byte character strings--&lt;SPAN&gt;interpretation is based on the current code page selected in the operating system. &amp;nbsp;Y&lt;/SPAN&gt;ou may turn on Unicode through the instructions provided in my first link (it is unsupported and can be a bit buggy on occasion...) to obtain &lt;SPAN style="text-decoration: line-through;"&gt;multibyte&lt;/SPAN&gt;&amp;nbsp;unicode character support to allow for multibyte characters not in the OS code page.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unicode has multiple encodings, and the raw bits for a given character&amp;nbsp;depend on the encoding used. &amp;nbsp;LabVIEW's limited unicode support appears to use&amp;nbsp;UTF-16LE (little-endian) encoding for anything displayed within the&amp;nbsp;UI. &amp;nbsp;So to get the characters to show up on the UI, you must enable unicode (instructions shown in my first link) and write the proper UTF-16LE codes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;IMG src="https://ip1.i.lithium.com/553d927a9d009ab9a8d934fee2fdcdb9c5268d4b/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f31353839303569314334453145303835393134363244422f696d6167652d73697a652f6f726967696e616c3f763d6d70626c2d312670783d2d31" border="0" alt="UnicodeExample.png" title="UnicodeExample.png" align="center" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;UTF-8 is more common and thus easier to work with outside of LabVIEW (e.g. my version of Notepad++ evidently does not support UTF-16LE). &amp;nbsp;I usually end up using UTF-8 encoded strings for files and converting them to UTF-16LE&amp;nbsp;&amp;nbsp;for display in LabVIEW.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;IMG src="https://ip1.i.lithium.com/d993ebb65431b5725259486dec3f0ed82860f3b7/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f31353839303769314633314346463442353744413445462f696d6167652d73697a652f6f726967696e616c3f763d6d70626c2d312670783d2d31" border="0" alt="UnicodeExampleUTF8.png" title="UnicodeExampleUTF8.png" align="center" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The unicode library in my first link has&amp;nbsp;the necessary subVIs for converting between UTF-8 and "Unicode" (i.e. UTF-16LE).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;</description>
    <pubDate>Thu, 06 Nov 2014 23:01:11 GMT</pubDate>
    <dc:creator>John_P1</dc:creator>
    <dc:date>2014-11-06T23:01:11Z</dc:date>
    <item>
      <title>Generate and Write unicode characters to file</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045009#M867943</link>
      <description>&lt;P style="text-transform: none; text-indent: 0px; margin: 0px; font: 12px/15px Arial; white-space: normal; letter-spacing: normal; color: #000000; word-spacing: 0px; -webkit-text-stroke-width: 0px; padding: 0px;"&gt;The genearted characters looks OK (up to x00FF) but after writing them to file those characters and their values are different. Also the characters after 0x00FF are not coming proper.&lt;/P&gt;
&lt;P style="text-transform: none; text-indent: 0px; margin: 0px; font: 12px/15px Arial; white-space: normal; letter-spacing: normal; color: #000000; word-spacing: 0px; -webkit-text-stroke-width: 0px; padding: 0px;"&gt;Any idea?&lt;/P&gt;
&lt;P style="text-transform: none; text-indent: 0px; margin: 0px; font: 12px/15px Arial; white-space: normal; letter-spacing: normal; color: #000000; word-spacing: 0px; -webkit-text-stroke-width: 0px; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="text-transform: none; text-indent: 0px; margin: 0px; font: 12px/15px Arial; white-space: normal; letter-spacing: normal; color: #000000; word-spacing: 0px; -webkit-text-stroke-width: 0px; padding: 0px;"&gt;&lt;IMG src="https://ip1.i.lithium.com/0c35d4fee46db24df6d2b7fa66dd10bb51b7902c/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f31353838353769303241434246383442434236324330322f696d6167652d73697a652f6f726967696e616c3f763d6d70626c2d312670783d2d31" border="0" alt="Unicode.png" title="Unicode.png" align="center" /&gt;&lt;IMG src="https://ip1.i.lithium.com/af354f3a249b2a64f9f6acbed52afd3cba9ae8f2/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f31353838353969323134363232394445423332304646352f696d6167652d73697a652f6f726967696e616c3f763d6d70626c2d312670783d2d31" border="0" alt="Characters.png" title="Characters.png" align="center" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2014 15:28:48 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045009#M867943</guid>
      <dc:creator>V_T_S</dc:creator>
      <dc:date>2014-11-06T15:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: Generate and Write unicode characters to file</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045043#M867949</link>
      <description>&lt;P&gt;When you do the conversion to U8, you guarantee that no value above x00FF can get to the file!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need multi-byte characters, you need to use mutliple U8s.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lynn&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2014 15:46:21 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045043#M867949</guid>
      <dc:creator>johnsold</dc:creator>
      <dc:date>2014-11-06T15:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Generate and Write unicode characters to file</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045239#M867980</link>
      <description>&lt;P&gt;Byte order mark was missing while writing the file -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/093d450fbe9d83a354fcc4c53257a1bfc8e04468/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f31353838373369363942463238344542324136464230392f696d6167652d73697a652f6f726967696e616c3f763d6d70626c2d312670783d2d31" border="0" alt="BOM.png" title="BOM.png" align="center" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But for charcters after 0XFF tried this option, which is not working&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/b148f37f043cb08bd7fac8aae8fea76d422d27d2/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f31353838373569424330454333463437354130364343462f696d6167652d73697a652f6f726967696e616c3f763d6d70626c2d312670783d2d31" border="0" alt="new image.png" title="new image.png" align="center" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any other option?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2014 18:07:54 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045239#M867980</guid>
      <dc:creator>V_T_S</dc:creator>
      <dc:date>2014-11-06T18:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: Generate and Write unicode characters to file</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045273#M867989</link>
      <description>&lt;P&gt;What do you mean by "...is not working"? The code works. It produces a string with the same bytes, reversed, as the number sent to the U16 conversion.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please specify a value of the input, and what you expect to get from the output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lynn&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2014 18:36:46 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045273#M867989</guid>
      <dc:creator>johnsold</dc:creator>
      <dc:date>2014-11-06T18:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Generate and Write unicode characters to file</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045297#M867994</link>
      <description>&lt;P&gt;Still not able to generate these characters -&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/682ff09e3e3c79195c154a9b652bf4c2294b9c90/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f31353838373769424144413134424130463532304239352f696d6167652d73697a652f6f726967696e616c3f763d6d70626c2d312670783d2d31" border="0" alt="Missing.png" title="Missing.png" align="center" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2014 19:05:07 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045297#M867994</guid>
      <dc:creator>V_T_S</dc:creator>
      <dc:date>2014-11-06T19:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: Generate and Write unicode characters to file</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045359#M868005</link>
      <description>&lt;P&gt;Is this file you're writing going to be read as a text file that has unicode in it?&amp;nbsp; If it is, you have to put a Unicode header in front of your data.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2014 20:17:27 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045359#M868005</guid>
      <dc:creator>billko</dc:creator>
      <dc:date>2014-11-06T20:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: Generate and Write unicode characters to file</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045367#M868008</link>
      <description>&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This little snippet produces a file that when opened in Wordpad contaains the text shown in the constant&amp;nbsp;on the BD&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/275118f7a8858c81be6b405855b94a1fea1b7e5c/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f31353838393369373439314639344642323145353632452f696d6167652d73697a652f6f726967696e616c3f763d6d70626c2d312670783d2d31" border="0" alt="Capture1.PNG" title="Capture1.PNG" align="center" /&gt;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2014 20:37:49 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045367#M868008</guid>
      <dc:creator>JÞB</dc:creator>
      <dc:date>2014-11-06T20:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: Generate and Write unicode characters to file</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045481#M868024</link>
      <description>&lt;P&gt;You should probably give &lt;A href="https://decibel.ni.com/content/docs/DOC-10153" target="_self"&gt;this page&lt;/A&gt;&amp;nbsp;a thorough read if you are intending on using Unicode in your application. &amp;nbsp;Here is a&amp;nbsp;relevant excerpt:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;ASCII technically only defines a 7-bit value and can accordingly represent 128 different characters including control characters such as newline (0x0A) and carriage return (0x0D). However ASCII characters in most applications including LabVIEW are stored as 8-bit values which can represent 256 different characters. The additional 128 characters in this extended ASCII range are defined by the operating system code page aka "Language for non-Unicode Programs".&amp;nbsp; For example,&lt;STRONG&gt; on a Western system, Windows defaults to the character set defined by the Windows-1252 code page.&lt;/STRONG&gt; Windows-1252 is an extension of another commonly used encoding called ISO-8859-1.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://en.wikipedia.org/wiki/Windows-1252" target="_self"&gt;Windows-1252&lt;/A&gt;&amp;nbsp;gives you characters up to 0xFF (ÿ) but not anything greater than 8-bits (e.g. no 0x0100). &amp;nbsp;By default&amp;nbsp;LabVIEW &lt;SPAN style="text-decoration: line-through;"&gt;only supports these 8-bit characters&lt;/SPAN&gt;&amp;nbsp;uses multi-byte character strings--&lt;SPAN&gt;interpretation is based on the current code page selected in the operating system. &amp;nbsp;Y&lt;/SPAN&gt;ou may turn on Unicode through the instructions provided in my first link (it is unsupported and can be a bit buggy on occasion...) to obtain &lt;SPAN style="text-decoration: line-through;"&gt;multibyte&lt;/SPAN&gt;&amp;nbsp;unicode character support to allow for multibyte characters not in the OS code page.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unicode has multiple encodings, and the raw bits for a given character&amp;nbsp;depend on the encoding used. &amp;nbsp;LabVIEW's limited unicode support appears to use&amp;nbsp;UTF-16LE (little-endian) encoding for anything displayed within the&amp;nbsp;UI. &amp;nbsp;So to get the characters to show up on the UI, you must enable unicode (instructions shown in my first link) and write the proper UTF-16LE codes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;IMG src="https://ip1.i.lithium.com/553d927a9d009ab9a8d934fee2fdcdb9c5268d4b/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f31353839303569314334453145303835393134363244422f696d6167652d73697a652f6f726967696e616c3f763d6d70626c2d312670783d2d31" border="0" alt="UnicodeExample.png" title="UnicodeExample.png" align="center" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;UTF-8 is more common and thus easier to work with outside of LabVIEW (e.g. my version of Notepad++ evidently does not support UTF-16LE). &amp;nbsp;I usually end up using UTF-8 encoded strings for files and converting them to UTF-16LE&amp;nbsp;&amp;nbsp;for display in LabVIEW.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;IMG src="https://ip1.i.lithium.com/d993ebb65431b5725259486dec3f0ed82860f3b7/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f31353839303769314633314346463442353744413445462f696d6167652d73697a652f6f726967696e616c3f763d6d70626c2d312670783d2d31" border="0" alt="UnicodeExampleUTF8.png" title="UnicodeExampleUTF8.png" align="center" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The unicode library in my first link has&amp;nbsp;the necessary subVIs for converting between UTF-8 and "Unicode" (i.e. UTF-16LE).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2014 23:01:11 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045481#M868024</guid>
      <dc:creator>John_P1</dc:creator>
      <dc:date>2014-11-06T23:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: Generate and Write unicode characters to file</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045525#M868030</link>
      <description>&lt;P&gt;Well... I learned something as well typing all of that out...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just had neglected&amp;nbsp;to write the byte order mark (BOM) when using the LabVIEW UTF-16LE. &amp;nbsp;When I do this the file works in Notepad or Notepad++ (which detects the file format as UCS-2 Little Endian).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;IMG src="https://ip1.i.lithium.com/c278e199bc7348f4ee473321c091df7af713e360/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f31353839313369443032444542363545364132303643382f696d6167652d73697a652f6f726967696e616c3f763d6d70626c2d312670783d2d31" border="0" alt="UnicodeExampleToFile.png" title="UnicodeExampleToFile.png" align="center" /&gt;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I still like UTF-8 personally as the BOM is not required.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2014 23:10:04 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045525#M868030</guid>
      <dc:creator>John_P1</dc:creator>
      <dc:date>2014-11-06T23:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: Generate and Write unicode characters to file</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045583#M868038</link>
      <description>&lt;P&gt;I've used the undocumented LabVIEW Unicode support quite often.&amp;nbsp; They work fairly well, but they're kind of twitchy.&amp;nbsp; If you can tame the beasts, they will serve you well.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2014 00:29:43 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Generate-and-Write-unicode-characters-to-file/m-p/3045583#M868038</guid>
      <dc:creator>billko</dc:creator>
      <dc:date>2014-11-07T00:29:43Z</dc:date>
    </item>
  </channel>
</rss>

