<div dir="ltr"><div class="gmail_default" style="font-family:monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:monospace;font-size:small">Thank you Juan, testing right now, seems all fine ! <br></div><div class="gmail_default" style="font-family:monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:monospace;font-size:small">bye</div><div class="gmail_default" style="font-family:monospace;font-size:small">Nicola</div><div class="gmail_default" style="font-family:monospace;font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jun 11, 2022 at 6:01 PM Juan Vuletich <<a href="mailto:JuanVuletich@zoho.com">JuanVuletich@zoho.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>

  
    
    
  
  <div bgcolor="#ffffff">
    Hi Nicola,<br>
    <br>
    Something like this should work:<br>
    <br>
    <br>
    utf16 _ 'expo-test-IT-UTF16.xml' asFileEntry binaryContents.<br>
    possibleBOM _ utf16 copyFrom: 1 to: 2.<br>
    isLittleEndian _ true. "use your best guess"<br>
    possibleBOM = #[255 254] ifTrue: [<br>
        isLittleEndian _ true.<br>
        utf16 _ utf16 copyFrom: 3 to: utf16 size ].<br>
    possibleBOM = #[254 255] ifTrue: [<br>
        isLittleEndian _ false.<br>
        utf16 _ utf16 copyFrom: 3 to: utf16 size ].<br>
    String streamContents: [ :out |<br>
        index _ 1.<br>
        [index < utf16 size] whileTrue: [<br>
            codePoint _ utf16 unsignedShortAt: index bigEndian:
    isLittleEndian not.<br>
            out nextPut: (Character codePoint: codePoint).<br>
            index _ index + 2 ]].<br>
    <br>
    As you see, after messing a bit with the silly ByteOrderMark (BOM),
    all we do is grab 2 bytes and store them as a Character.<br>
    <br>
    Good luck with your project!<br>
    <br>
    Cheers,<br>
    <br>
    On 6/11/2022 5:02 AM, Nicola Mingotti via Cuis-dev wrote:
    <blockquote type="cite">
      
      <div>
        <div>Hi Jaun,</div>
        <div><br>
        </div>
        <div>I can share this data file, it is attached. <br>
        </div>
        <div>It is the output reading of a machine who does a NIR
          analysis on a corn sample.</div>
        <div>Once the machine GUI has been set to work in Italian. <br>
        </div>
        <div><br>
        </div>
        <div>bye</div>
        <div>Nicola<br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <br>
      <div>
        <div>On Sat, Jun 11, 2022 at 2:02 AM Juan Vuletich <<a href="mailto:JuanVuletich@zoho.com" target="_blank">JuanVuletich@zoho.com</a>>
          wrote:<br>
        </div>
        <blockquote>
          <div> On 6/10/2022 8:25 PM, Nicola Mingotti via Cuis-dev
            wrote:
            <blockquote type="cite">
              <div>
                <div>Hi guys, <br>
                </div>
                <div><br>
                </div>
                <div>as title says, I am converting a script from Python
                  to Cuis.</div>
                <div>It reads an XML file and does stuff consequently.
                  Unfortunately the <br>
                </div>
                <div>XML is in UTF-16 (we are running in Windows).</div>
                <div><br>
                </div>
                <div>I am sure the file content is convertible to
                  Latin-1 since it is Italian</div>
                <div>text stuff. <br>
                </div>
                <div><br>
                </div>
                <div>Do you have any quick way to solve it from Cuis ?</div>
                <div><br>
                </div>
                <div>The XML part is working, already tested converting
                  UTF16 to Latin-1</div>
                <div>with an external editor. <br>
                </div>
                <div><br>
                </div>
                <div>bye</div>
                <div>Nicola</div>
              </div>
            </blockquote>
            <br>
            Hi Nicola,<br>
            <br>
            Can you send me (to the mail list or to <a href="mailto:juan@jvuletich.org" target="_blank">juan@jvuletich.org</a>
            ) one of those files in a zip file? I'll show you how to do
            it, but I need an example. The zip file is to ensure that I
            get it exactly as you have it.<br>
            <br>
            Cheers,<br>
            <pre>-- 
Juan Vuletich
<a href="http://www.cuis-smalltalk.org" target="_blank">www.cuis-smalltalk.org</a>
<a href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev" target="_blank">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a>
<a href="https://github.com/jvuletich" target="_blank">https://github.com/jvuletich</a>
<a href="https://www.linkedin.com/in/juan-vuletich-75611b3" target="_blank">https://www.linkedin.com/in/juan-vuletich-75611b3</a>
<a href="https://independent.academia.edu/JuanVuletich" target="_blank">https://independent.academia.edu/JuanVuletich</a>
<a href="https://www.researchgate.net/profile/Juan-Vuletich" target="_blank">https://www.researchgate.net/profile/Juan-Vuletich</a>
<a href="https://patents.justia.com/inventor/juan-manuel-vuletich" target="_blank">https://patents.justia.com/inventor/juan-manuel-vuletich</a>
<a href="https://twitter.com/JuanVuletich" target="_blank">https://twitter.com/JuanVuletich</a></pre>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <br>
    <br>
    <pre cols="72">-- 
Juan Vuletich
<a href="http://www.cuis-smalltalk.org" target="_blank">www.cuis-smalltalk.org</a>
<a href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev" target="_blank">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a>
<a href="https://github.com/jvuletich" target="_blank">https://github.com/jvuletich</a>
<a href="https://www.linkedin.com/in/juan-vuletich-75611b3" target="_blank">https://www.linkedin.com/in/juan-vuletich-75611b3</a>
<a href="https://independent.academia.edu/JuanVuletich" target="_blank">https://independent.academia.edu/JuanVuletich</a>
<a href="https://www.researchgate.net/profile/Juan-Vuletich" target="_blank">https://www.researchgate.net/profile/Juan-Vuletich</a>
<a href="https://patents.justia.com/inventor/juan-manuel-vuletich" target="_blank">https://patents.justia.com/inventor/juan-manuel-vuletich</a>
<a href="https://twitter.com/JuanVuletich" target="_blank">https://twitter.com/JuanVuletich</a></pre>
  </div>

</blockquote></div>