How to use utf8 encode in PHP
In this article I will explain how the utf8_encode() function can be used in PHP.
XML Parser function in PHP
- XML is the eXtensible Markup language.
- XML is a data format for standardized structured document interchange on the web.
- XML extension uses the Expat XML parser.
- Expat XML parser is an event-based parser, it displays an XML document as a series of events.
- Expat XML parser calls a specified function to handle it, When an event occurs.
- Expat XML parser is a non-validating parser, and ignores any DTDs linked to a document. However,
- Expat XML parser will end with an error message, if the document is not well formed
- Expat XML parser is fast and well suited for web applications.
utf8_encode() function in PHP
- The utf8_encode() function is used to encode an ISO-8859-1 string data to UTF-8.
- The utf8_encode() function returns encode version of string.
- The utf8_encode() function is a standard mechanism used by Unicode for encoding wide character values into a byte stream.
- The utf8_encode() function is transparent to plain ASCII characters.
- The utf8_encode() function is self-synchronized.
- The utf8_encode() function has been developed to transfer a Unicode character from one computer to another computer
- The utf8_encode() function returns the encoded string on success.
- The utf8_encode() function returns FALSE on failure.
UTF-8 encoding
|
bytes |
bits |
representation |
1 |
7 |
0bbbbbbb |
2 |
11 |
110bbbbb 10bbbbbb |
3 |
16 |
1110bbbb 10bbbbbb 10bbbbbb |
4 |
21 |
11110bbb 10bbbbbb 10bbbbbb 10bbbbbb |
- where each b represents a bit that can be used to store character data.
Syntax
Parameter
- string string is required parameter. it is specify for encode to the string.
Output
You may also want to read these related articles here
Ask Your Question
Got a programming related question? You may want to post your question here