Zend - The PHP Company




Code Gallery: ronen


Convert UTF-8 encoded string to Unicode entities  

Type: code fragment
Added by: ronen
Entered: 02/03/2002
Last modified: 07/12/2001
Rating: - (fewer than 3 votes)
Views: 11937
Takes a string of utf-8 encoded characters and converts it to a string of unicode entities. Each unicode entitiy has the form nnnnn; or nnn; n={0..9} and can be displayed by utf-8 supporting browsers. If the character passed maps as lower ascii it stays as such (a single char) instead of being presented as a unicode entity


utf8Encode  

Type: code fragment
Added by: ronen
Entered: 07/03/2002
Last modified: 05/12/2002
Rating: - (fewer than 3 votes)
Views: 8112
UTF-8 encodes a string of Unicode entities . Each Unicode entitiy should has either the form &[#]nn..n; n={0..9} (# denotes decimal, otherwise Hex) which is the W3C style or %nn with n=[0..F] Hex value. The value of the entity corresponds to its Unicode charcode. The entity can be displayed by UTF-8 supporting browsers. ASCII will not be modified. Currently maps a 2^21bit space. The next version will be compliant with Unicode v3.x and cover a 2^31bit space (still, this should cover the existing 95,000~ Unicode entities).


utf8RawUrlDecode  

Type: code fragment
Added by: ronen
Entered: 07/03/2002
Last modified: 07/12/2001
Rating: - (fewer than 3 votes)
Views: 7856
RFC1738 compliant alternative to PHP's rawurldecode, which actually works with unicode entities (using utf-8 encoding). Also included is a fix to the javascript method escape(), which ensures RFC1738 compliant encoding of strings containing utf-8 and/or ascii.




Search