0

I am programming in C using the libxml2 library, I am converting a normal xml file into valid XMLTV format but the Spanish characters are not displaying correctly.

I am aware that the xml encoding for Spanish characters should be UTF-8.

I have this line at the top of my files:

<?xml version="1.0" encoding="utf-8"?>

And I also use the libxml function:

xmlSaveFormatFileEnc( (const xmlChar *) szFilename, doc, "utf-8", 1 );

which I believe is meant to save the file in utf-8 encoding.

When importing the xmltv file to the EPG the Spanish characters are displaying as different Spanish characters (e.g. é may display as Á). I have the feeling the file is still not encoding in UTF-8 but in ISO-8859-1

Jam12345
  • 133
  • 1
  • 1
  • 7
  • So far we haven't been able to answer this question when [you asked it yesterday](https://stackoverflow.com/questions/56967822/xmltv-spanish-characters-not-appearing-correctly?noredirect=1#comment100484036_56967822) and without more information we aren't going to be able to answer it today, either. Can you show an example of some proper Spnish text in the XML file and the exact, wrong way it's being displayed? (Copy and paste if you can do that and it looks right, screenshot otherwise.) – Steve Summit Jul 11 '19 at 11:14
  • One common problem manifests itself as, say, "Á" displaying as "Ã", and "ñ" displaying as "ñ". But based on what you said yesterday I'm not sure that's your problem. – Steve Summit Jul 11 '19 at 11:18
  • I can test this character just now and get back to you – Jam12345 Jul 11 '19 at 11:19
  • If you have a file that's actually UTF-8 (which is quite common), and you're accidentally interpreting/displaying it as if it were ISO-8859-1 (which is a common mistake), é would display as é, because the UTF-8 representation of é is `0xc3 0xa9`. (And this is indeed the same problem I was speculating about in my earlier comment.) – Steve Summit Jul 11 '19 at 11:23
  • I suspect you're encoding the file just fine. I suspect the problem is that EPG (or some code downstream from EPG) is wrongly interpreting the text as 8859-1, essentially ignoring the fact that you've properly tagged it as UTF-8. How old a program is EPG? – Steve Summit Jul 11 '19 at 11:26
  • @SteveSummit You are bang on with what is happenning "ñ" displaying as "ñ" – Jam12345 Jul 11 '19 at 11:32

0 Answers0