PDA

View Full Version : Convert characters to entities



estanisgeyer
11th November 2008, 15:17
Hi friends,

I'm need convert QString characters, like "ç", "á", "â" and others to respective entities.
Ex.: Caçar to Caçar.

I'ts possible? I find Qt::escape( ), but don't work with these characters.
Thanks,

Marcelo E. Geyer.

caduel
11th November 2008, 22:28
(Side note: a html file may be encoded in utf-8, iso 8859-1 or other encodings.
therefore it is not necessary to replace these unicode characters in a unicode html encoding. However, "<", ">", "&" do have to be escaped, which is what Qt::escape does.)

What you want to achieve is html text that displays unicode but is encoded in something like iso 8859-1, right?

I am not aware of a function in Qt that does this (though there might be one).
So I can only suggest that you define that mapping in your code and iterate over your html replacing such characters by their entity.

HTH