Another important issue when working with different character sets is to avoid double encoding, i.e. encoding a string to UTF-8 which already is UTF-8 encoded, and to avoid mixed encoding within the same string or document, in which case there will be bad characters dsiplayed and guessing the right encoding will then be impossible.