[mythtv-commits] Ticket #9797: Play Blu Ray from storage groups with directories whose names contain Cyrillic characters

MythTV noreply at mythtv.org
Wed Apr 11 08:50:58 UTC 2012


#9797: Play Blu Ray from storage groups with directories whose names contain
Cyrillic characters
---------------------------------------+----------------------------
 Reporter:  sandybigboy@…              |          Owner:
     Type:  Patch - Bug Fix            |         Status:  new
 Priority:  minor                      |      Milestone:  unknown
Component:  MythTV - Blu-ray Playback  |        Version:  0.24-fixes
 Severity:  medium                     |     Resolution:
 Keywords:                             |  Ticket locked:  0
---------------------------------------+----------------------------

Comment (by sandybigboy@…):

 I must say that I am not a programmer, but I did some experimenting and
 Google on this topic.

 It seems that replacing filename.toLatin1 () on filename.toLocal8Bit () in
 file BDRingBuffer.cpp (DVDRingBuffer.cpp in the file it is) we will solve
 the problem, but in reality it is not.
 As I understand the problem is that outside of the context object
 QApplication and QCoreApplication Qt does not know about local encoding.
 And in the code of BDRingBuffer.cpp and DVDRingBuffer.cpp this context is
 not exists, so we have to explicitly specify the encoding for strings with
 codecForName. Here's an example:

 QApplication app (argc, argv);
 setlocale (LC_ALL, "");

      QTextCodec * vpCodec = QTextCodec :: codecForLocale ();
      if (vpCodec) {
          QTextCodec :: setCodecForCStrings (vpCodec);
      }

      const QString & filename = "привет!";
      QString fn = filename.toLocal8Bit (). Data ();

 In this code, the value of variable fn will be appropriate encoding of the
 locale.

 In the code:

 QTextCodec * vpCodec = QTextCodec :: codecForLocale ();
      if (vpCodec) {
          QTextCodec :: setCodecForCStrings (vpCodec);
      }

      const QString & filename = "/ hello";
      QString fn = filename.toLocal8Bit (). Data ();

 no object QApplication, Qt will use the default encoding, and our code
 will work only if we specify the codec with, for example QTextCodec ::
 codecForName ("UTF-8")

 Apologize for bad English, and perhaps not the correct terminology

-- 
Ticket URL: <http://code.mythtv.org/trac/ticket/9797#comment:15>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center


More information about the mythtv-commits mailing list