toUTF8()
toUTF8( text) :
Function Encoding::toUTF8
This function leaves UTF8 characters alone, while converting almost all non-UTF8 to UTF8.
It assumes that the encoding of the original string is either Windows-1252 or ISO 8859-1.
It may fail to convert characters to UTF-8 if they fall into one of these scenarios:
1) when any of these characters: ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞß are followed by any of these: ("group B") ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶•¸¹º»¼½¾¿ For example: %ABREPRESENT%C9%BB. «REPRESENTÉ» The "«" (%AB) character will be converted, but the "É" followed by "»" (%C9%BB) is also a valid unicode character, and will be left unchanged.
2) when any of these: àáâãäåæçèéêëìíîï are followed by TWO chars from group B, 3) when any of these: ðñòó are followed by THREE chars from group B.
Parameters
text | Any string. |
Returns
—The same string, UTF8 encoded