0
votes

We need our web application to handle additional characters - and so need to move from ISO-8859-1 to UTF-8. So my q is UTF-8 backwards compatible with ISO-8859-1?

I have made the following changes, and can now handle all characters, but want to make sure there's no edge cases I'm missing.

  1. Changed Content-Type: from "text/html; charset=ISO-8859-1" to "text/html; charset=UTF-8"

  2. Tomcat Connector URIEncoding from ISO-8859-1 to UTF-8

Thanks

1
I suggest you to change the text encodings and the db encodings also. For mysql, change the db collation, field collation values to utf-8 unicode ci and also while saving the ascii files, select utf-8. All the files in your application needs to be utf-8 including css, js and other files. Otherwise, your additional chars will be displayed wrong. - artuc
Thanks, checked db and it looks good. - Damo

1 Answers

1
votes

is UTF-8 backwards compatible with ISO-8859-1?

Unicode is a superset of the code points contained in ISO-8859-1 so all the "characters" can be represented in UTF-8 but how they map to byte values is different. There is overlap between the encoded values but it is not 100%.

In terms of serving content or processing forms submissions you are unlikely to have many issues.

It may mean a breaking change for URL handling. For example, for a parameter value naïve there would be two incompatible forms:

  • http://example.com/foo?p=na%EFve
  • http://example.com/foo?p=na%C3%AFve

This is only likely to be an issue if there are external applications relying on the old form.