Menu

#52 ImageFile::ImageFile doesn't use UTF-8

open
nobody
None
1
2021-06-02
2019-07-25
No

The first argument to ImageFile::ImageFile has type e57::ustring. e57::ustring is described as “UTF-8 encodeded Unicode string”. However, on Windows no attempt is made to call the correct Unicode API with correctly converted wide string. Instead a blind call to _sopen_s is made, passing e57::ustring as is. It leads to corrupted file names if they have local symbols.

Related

Bug Reports: #52

Discussion

  • Alon Barzilai

    Alon Barzilai - 2021-06-02

    I used this change to src/refimpl/E57FoundationImpl.cpp

    //add this to somewhere in the top of the file after
    #  if defined(_MSC_VER)
    #    include <io.h>
    #    include <fcntl.h>
    #    include <sys\stat.h>
    #    include <codecvt>
    
    and then replace the first few lines of CheckedFile::open64 with this:
    
    int CheckedFile::open64(ustring fileName, int flags, int mode)
    {
    //??? handle utf-8 file names?
    #if defined(_MSC_VER)
        std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t> utf16conv;
        std::wstring wfileName = utf16conv.from_bytes(fileName);
    
        int handle;
        int err = _wsopen_s(&handle, wfileName.c_str(), flags, _SH_DENYNO, mode);
    
     

    Last edit: Alon Barzilai 2021-06-02
    • Stan Coleby

      Stan Coleby - 2021-06-04

      Let me work on that tomorrow because I don’t know if I have admin for sourceforge. Stan

      Sent from my iPhone

      On Jun 1, 2021, at 10:32 PM, Alon Barzilai alonb@users.sourceforge.net wrote:

      
      I used this change to src/refimpl/E57FoundationImpl.cpp

      int CheckedFile::open64(ustring fileName, int flags, int mode)
      {
      //??? handle utf-8 file names?

      if defined(_MSC_VER)

      std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> utf16conv;
      std::u16string wfileName = utf16conv.from_bytes(fileName);
      
      int handle;
      int err = _wsopen_s(&handle, (wchar_t*)wfileName.c_str(), flags, _SH_DENYNO, mode);
      

      [bug-reports:#52] ImageFile::ImageFile doesn't use UTF-8

      Status: open
      Group:
      Created: Thu Jul 25, 2019 11:50 PM UTC by
      Last Updated: Thu Jul 25, 2019 11:50 PM UTC
      Owner: nobody

      The first argument to ImageFile::ImageFile has type e57::ustring. e57::ustring is described as “UTF-8 encodeded Unicode string”. However, on Windows no attempt is made to call the correct Unicode API with correctly converted wide string. Instead a blind call to _sopen_s is made, passing e57::ustring as is. It leads to corrupted file names if they have local symbols.

      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/e57-3d-imgfmt/bug-reports/52/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

      Related

      Bug Reports: #52

    • Stan Coleby

      Stan Coleby - 2021-06-04

      OK, I made you a developer for this project. You can make the update.
      Stan Coleby

      On Tue, Jun 1, 2021 at 10:32 PM Alon Barzilai alonb@users.sourceforge.net
      wrote:

      I used this change to src/refimpl/E57FoundationImpl.cpp

      int CheckedFile::open64(ustring fileName, int flags, int mode){//??? handle utf-8 file names?#if defined(_MSC_VER)
      std::wstring_convert<std::codecvt_utf8_utf16\<char16_t>, char16_t> utf16conv;
      std::u16string wfileName = utf16conv.from_bytes(fileName);</std::codecvt_utf8_utf16\<char16_t>

      int handle;
      int err = _wsopen_s(&handle, (wchar_t*)wfileName.c_str(), flags, _SH_DENYNO, mode);
      

      Status: open
      Group:
      Created: Thu Jul 25, 2019 11:50 PM UTC by
      Last Updated: Thu Jul 25, 2019 11:50 PM UTC
      Owner: nobody

      The first argument to ImageFile::ImageFile has type e57::ustring.
      e57::ustring is described as “UTF-8 encodeded Unicode string”. However,
      on Windows no attempt is made to call the correct Unicode API with
      correctly converted wide string. Instead a blind call to _sopen_s is
      made, passing e57::ustring as is. It leads to corrupted file names if
      they have local symbols.


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/e57-3d-imgfmt/bug-reports/52/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bug Reports: #52

      • Stan Coleby

        Stan Coleby - 2021-06-04

        You have developer status and can update. Just make sure that you download
        the latest version first before you make the change. Otherwise you would
        wipe out other changes. A new release hasn't been done in a long time.Stan
        Coleby

        On Fri, Jun 4, 2021 at 10:57 AM Stan Coleby stancoleby@users.sourceforge.net wrote:

        OK, I made you a developer for this project. You can make the update.
        Stan Coleby

        On Tue, Jun 1, 2021 at 10:32 PM Alon Barzilai alonb@users.sourceforge.net
        wrote:

        I used this change to src/refimpl/E57FoundationImpl.cpp

        int CheckedFile::open64(ustring fileName, int flags, int mode){//???
        handle utf-8 file names?#if defined(_MSC_VER)
        std::wstring_convert<std::codecvt_utf8_utf16\<char16_t>, char16_t>
        utf16conv;
        std::u16string wfileName =
        utf16conv.from_bytes(fileName);</std::codecvt_utf8_utf16<char16_t></char16_t></std::codecvt_utf8_utf16\<char16_t>

        int handle;
        int err = _wsopen_s(&handle, (wchar_t*)wfileName.c_str(), flags, _SH_DENYNO, mode);


        Status: open
        Group:
        Created: Thu Jul 25, 2019 11:50 PM UTC by
        Last Updated: Thu Jul 25, 2019 11:50 PM UTC
        Owner: nobody

        The first argument to ImageFile::ImageFile has type e57::ustring.
        e57::ustring is described as “UTF-8 encodeded Unicode string”. However,
        on Windows no attempt is made to call the correct Unicode API with
        correctly converted wide string. Instead a blind call to _sopen_s is
        made, passing e57::ustring as is. It leads to corrupted file names if
        they have local symbols.


        Sent from sourceforge.net because you indicated interest in
        https://sourceforge.net/p/e57-3d-imgfmt/bug-reports/52/

        To unsubscribe from further messages, please visit
        https://sourceforge.net/auth/subscriptions/


        Status: open
        Group:
        Created: Thu Jul 25, 2019 11:50 PM UTC by
        Last Updated: Wed Jun 02, 2021 04:32 AM UTC
        Owner: nobody

        The first argument to ImageFile::ImageFile has type e57::ustring.
        e57::ustring is described as “UTF-8 encodeded Unicode string”. However,
        on Windows no attempt is made to call the correct Unicode API with
        correctly converted wide string. Instead a blind call to _sopen_s is
        made, passing e57::ustring as is. It leads to corrupted file names if
        they have local symbols.


        Sent from sourceforge.net because you indicated interest in
        https://sourceforge.net/p/e57-3d-imgfmt/bug-reports/52/

        To unsubscribe from further messages, please visit
        https://sourceforge.net/auth/subscriptions/

         

        Related

        Bug Reports: #52

        • Alon Barzilai

          Alon Barzilai - 2021-06-07
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <style id="user-content-bidiui-paragraph-margins" type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>

          Hi,

          thanks for the change.


          I made my commit.


          Alon.




          On 6/5/2021 12:41 AM, Stan Coleby wrote:
          <meta http-equiv="content-type" content="text/html; charset=UTF-8">

          You have developer status and can update. Just make sure that you download
          the latest version first before you make the change. Otherwise you would
          wipe out other changes. A new release hasn't been done in a long time.Stan
          Coleby

          On Fri, Jun 4, 2021 at 10:57 AM Stan Coleby stancoleby@users.sourceforge.net wrote:

          OK, I made you a developer for this project. You can make the update.
          Stan Coleby

          On Tue, Jun 1, 2021 at 10:32 PM Alon Barzilai alonb@users.sourceforge.net
          wrote:

          I used this change to src/refimpl/E57FoundationImpl.cpp

          int CheckedFile::open64(ustring fileName, int flags, int mode){//???
          handle utf-8 file names?#if defined(_MSC_VER)
          std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>
          utf16conv;
          std::u16string wfileName =
          utf16conv.from_bytes(fileName);</std::codecvt_utf8_utf16<char16_t>

          int handle;
          int err = _wsopen_s(&handle, (wchar_t*)wfileName.c_str(), flags, _SH_DENYNO, mode);


          Status: open
          Group:
          Created: Thu Jul 25, 2019 11:50 PM UTC by
          Last Updated: Thu Jul 25, 2019 11:50 PM UTC
          Owner: nobody

          The first argument to ImageFile::ImageFile has type e57::ustring.
          e57::ustring is described as “UTF-8 encodeded Unicode string”. However,
          on Windows no attempt is made to call the correct Unicode API with
          correctly converted wide string. Instead a blind call to _sopen_s is
          made, passing e57::ustring as is. It leads to corrupted file names if
          they have local symbols.


          Sent from sourceforge.net because you indicated interest in
          https://sourceforge.net/p/e57-3d-imgfmt/bug-reports/52/

          To unsubscribe from further messages, please visit
          https://sourceforge.net/auth/subscriptions/


          Status: open
          Group:
          Created: Thu Jul 25, 2019 11:50 PM UTC by
          Last Updated: Wed Jun 02, 2021 04:32 AM UTC
          Owner: nobody

          The first argument to ImageFile::ImageFile has type e57::ustring.
          e57::ustring is described as “UTF-8 encodeded Unicode string”. However,
          on Windows no attempt is made to call the correct Unicode API with
          correctly converted wide string. Instead a blind call to _sopen_s is
          made, passing e57::ustring as is. It leads to corrupted file names if
          they have local symbols.


          Sent from sourceforge.net because you indicated interest in
          https://sourceforge.net/p/e57-3d-imgfmt/bug-reports/52/

          To unsubscribe from further messages, please visit
          https://sourceforge.net/auth/subscriptions/


          [bug-reports:#52] ImageFile::ImageFile doesn't use UTF-8

          Status: open
          Group:
          Created: Thu Jul 25, 2019 11:50 PM UTC by
          Last Updated: Wed Jun 02, 2021 04:32 AM UTC
          Owner: nobody

          The first argument to ImageFile::ImageFile has type e57::ustring. e57::ustring is described as “UTF-8 encodeded Unicode string”. However, on Windows no attempt is made to call the correct Unicode API with correctly converted wide string. Instead a blind call to _sopen_s is made, passing e57::ustring as is. It leads to corrupted file names if they have local symbols.


          Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/e57-3d-imgfmt/bug-reports/52/

          To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

          <link itemprop="url" href="https://sourceforge.net/p/e57-3d-imgfmt/bug-reports/52/"> <meta itemprop="name" content="View">
          <meta itemprop="description" content="View">
           

          Related

          Bug Reports: #52


Log in to post a comment.

MongoDB Logo MongoDB