Menu

description function byteArrayToUtf8String

Anonymous
2018-10-29
2019-01-13
  • Anonymous

    Anonymous - 2018-10-29

    hi,

    in the manual is a description of the function

    Converts a byte array which contains utf8 characters into an utf8 string (QString).

    it would be better to write:

    Converts a byte array which contains utf8 characters into an Unicode string (QString).

    i'm not a programmer and I was surprised why it's not utf-8.

     
  • Stefan Zieker

    Stefan Zieker - 2018-10-29

    Hi,

    this would not be correct. Because Unicode is not just utf-8. utf-32 for example is also Unicode. But I could write: Converts a byte array which contains utf8 (Unicode) characters into an utf8 (Unicode) string (QString).
    What do you think?

    And thx for your thoughts/ your comment. I'm always trying to improve the documentation.

    Regards
    Stefan

     
    • Anonymous

      Anonymous - 2018-10-29

      Yes you are right, sorry.

      I think the function is return utf-16 format.

       
  • Stefan Zieker

    Stefan Zieker - 2018-10-29

    Hi,

    I'm calling QString::fromUtf8 internally. In other words byteArrayToUtf8String retruns a QString. The name of this function should better be utf8ByteArrayToString. Maybe I rename this function in a future release (but keep it internally for compabillity with older scripts).

    I had a look in the Qt documentation. QString stores strings in utf-16 format internally. All script strings in ScriptCommunicator are stored as QString strings.

     

    Last edit: Stefan Zieker 2018-10-29
    • Anonymous

      Anonymous - 2018-10-29

      thank you for the explanation. would it be possible to create a new function (StringToUtf8byteArray?) which would create utf-8 from Qstring (utf-16 internally)?

       
  • Stefan Zieker

    Stefan Zieker - 2018-10-29

    This would be no problem. I could create a prerelease. Which plattform do you use (Windows ...)?

     
    • Anonymous

      Anonymous - 2018-10-29

      yes, the 'awesome' windows platform. Thank you.

       
  • Stefan Zieker

    Stefan Zieker - 2018-10-29

    I have uploaded a prerelease under Files/Test.
    The new function is called conv.stringToUtf8Array.

    Regards,
    Stefan

     

    Last edit: Stefan Zieker 2018-10-29
    • Anonymous

      Anonymous - 2018-10-29

      function works perfectly. test Pangram sentences in my language have passed correctly. curl, servers and me are happy.

      thank you once again

       
  • Stefan Zieker

    Stefan Zieker - 2018-10-30

    my pleasure

     
  • Stefan Zieker

    Stefan Zieker - 2019-01-13

    Hi,

    I have released a new version of ScriptCommunicator (5.10) which includes this new feature.

     

Anonymous
Anonymous

Add attachments
Cancel