Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. [Closed]Unicode symbols
Forum Updated to NodeBB v4.3 + New Features

[Closed]Unicode symbols

Scheduled Pinned Locked Moved 3rd Party Software
4 Posts 2 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    leo150
    wrote on last edited by
    #1

    Hi everyone,

    I use QFileDialog to parse file path and then open it with OpenCV. My code is:

    @QString fileName = QFileDialog::getOpenFileName();

    Mat imageMat = imread( fileName.toLocal8Bit().constData() );@

    And this works fine but my imageMat is empty when I use non-latin characters. How to get image with unicode path?

    Regards.

    UPD:
    Imread isn't working with non-ascii directories/paths.
    http://code.opencv.org/issues/1268

    1 Reply Last reply
    0
    • I Offline
      I Offline
      Ildar
      wrote on last edited by
      #2

      Try using "QTextCodec":http://qt-project.org/doc/qt-5/qtextcodec.html

      1 Reply Last reply
      0
      • L Offline
        L Offline
        leo150
        wrote on last edited by
        #3

        [quote author="Ildar" date="1412076071"]Try using "QTextCodec":http://qt-project.org/doc/qt-5/qtextcodec.html[/quote]

        Can you explain in more detail please? I use

        @QTextCodec *codec = QTextCodec::codecForName("UTF-8");
        QTextCodec::setCodecForLocale(codec);@

        But it does not have any effect.

        1 Reply Last reply
        0
        • I Offline
          I Offline
          Ildar
          wrote on last edited by
          #4

          TextCodec is need to convert not UTF to UTF and vice versa. For example:
          @
          QTextCodec *codec = QTextCodec::codecForName("CP1251");
          ...
          QByteArray cp1251Array = codec->fromUnicode(utfString);
          QByteArray utfArray = codec->toUnicode(cp1251Array);
          @

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved