Two encodings in one HTML document

My problem is this:

I copy the HTML set from the computer to another, and I add more information to the target HTML as an element. The problem is that the source documents are encoded in many different encodings [UTF8, 8859-1, GB1232, etc.], and the meta-information is stored as UTF-8, so when I "fictitiously" merge my meta information with the original document , my meta information [which contains international characters] looks strange.

So, is there a way to use the HTML encoding defined in <META> and in tags! DOCTYPE in the entire HTML document, except in the TABLE or in the DIV section, which will use a different encoding specified there?

thanks in advance,

Ernesto

+4
source share
2 answers

No no.

I suggest you use DOM parsers to read various bits of HTML in memory, and then build a merged document in UTF-8. After these HTML fragments are in memory (after parsing), they will be displayed as Unicode (depending on the programming language), and therefore information should not be lost along this path.

+3
source

No, you need to use a character encoding, which is the union of the encodings that are used. Therefore, in your case, I suggest you use UTF-8 for all of your documents. Or you use symbolic links instead of the simplest symbol if they cannot be encoded using the encoding used in the document.

+1
source

All Articles