[mythtv-commits] Ticket #9918: Incorrect character encoding in xml status (patch provided)

MythTV noreply at mythtv.org
Wed Jul 13 13:22:37 UTC 2011


#9918: Incorrect character encoding in xml status (patch provided)
-------------------------------------------------+-------------------------
 Reporter:  Ian Dall <ian@…>                     |          Owner:
     Type:  Bug Report - General                 |         Status:
 Priority:  minor                                |  infoneeded_new
Component:  MythTV - General                     |      Milestone:  unknown
 Severity:  medium                               |        Version:
 Keywords:  xml encoding                         |  Unspecified
                                                 |     Resolution:
                                                 |  Ticket locked:  0
-------------------------------------------------+-------------------------

Comment (by Ian Dall <ian@…>):

 Thanks, setting LANG as above does result in UTF-8 encoded xml which
 parses without error.

 The thing is, if LANG isn't *.UTF-8, then the xml is invalid, as any
 encoding except UTF-8 must have a "Text Declaration" (or a "Byte Order
 Mark" if it is UTF-16). [w3c xml 1.0 Section 4.3.3]

 So, I guess it is a low priority given there is a work around, but I would
 maintain that either UTF-8 locale should be forced (as my patch does) or
 the text declaration should be added with the encoding which is actually
 used. Something like:

 {{{
     QTextCodec *default_enc = QTextCodec::codecForLocale();
     QDomProcessingInstruction encoding =
 doc.createProcessingInstruction("xml", "version=\"1.0\" encoding=\""
                                                                          +
 default_enc->name() + "\"");
     doc.appendChild(encoding);
 }}}

 Unfortunately this doesn't work because QTextCodec::codecForLocale()
 always has a name of "System" in Qt 4.7, so I can't see any clean way to
 do this.

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


More information about the mythtv-commits mailing list