Is there a way to specify certain part of a html file as another encoding?
The default encoding for the (generated) html is utf-8. However, some of the included data to be inserted in the html is in another encoding. It’s something like:
<div>
the normal html in utf-8
</div>
<div>
<%= raw_data_in_another_encoding %>
</div>
Is there a way to hint a browser to render the 2nd <div> in another encoding? thanks
No, the entire file must have a single encoding. If you’re saving a plain .html file, you’ll have to convert the entire file to one encoding.
If you’re using a server-side scripting language, however, you can always convert text from one encoding to another. You might designate UTF-8 as the encoding for the page, and then when you encounter bits of content currently encoded in, say, latin1, you can simply convert it to UTF-8 before outputting it.
How you do that, of course, would depend on the particular server-side language you’re using.
In PHP, you could do: