PHP Tutorials - Tutorial Addendum - Non ASCII Characters as Cord Literals
| |
(Continued from antecedent part...)
Chinese Characters in Cord Literals - GB2312 Encoding
I anticipate we are accessible to analysis Chinese characters in PHP scripts with GB2312 encoding action now.
1. This time, we can not use Notepad, because Block is not accordant with GB2312 encoding.
It will infact catechumen GB2312 encoding to UTF-8 encoding. So don t use Notepad.
You charge to go get addition argument editor, like Jext, to advice you access the Chinese
characters in GB2312 encoding.
2. In a acceptable argument editor, access the afterward HTML document:
<?php #HelpGb2312Chinese.php
# Absorb (c) 2005 by Dr. Yang, http://www.yang.com/
#
print( <html> );
print( <meta http-equiv="Content-Type" .
content="text/html; charset=gb2312"/> );
print( <body> );
print( <b>?</b><br/> );
print("??????<br/>");
print( </body> );
print( </html> );
?>
Be careful, if you apprehend the aloft cipher in this book, Chinese characters may not be displayed
correctly. The cause is afresh that my book is accounting in ISO-8859-1 encoding.
3. Entering Chinese characters in GB2312 encoding aswell requires some Chinese ascribe tools.
If you don t accept any Chinese ascribe tool, you can artlessly go to my GB2312 page, http://www.yang.com/gb2312_gb/,
open the antecedent cipher of the page, archetype some Chinese characters, and adhesive them into the editor.
My GB2312 page is encoded in GB2312. Warning, do not archetype Chinese characters from the IE browser window.
The browser window archetype action is bold UTF-8 encoding and will base the affected characters.
4. Baddest card book > Save as. Access the book name as HelpGb2312Chinese.php and bang the Save button.
5. Archetype HelpGb2312Chinese.php to c:inetpubwwwroot. Create abiding your Internet
Information Account is active the bounded absence Web site.
6. Now run Internet Explorer (IE) with http://localhost/HelpGb2312Chinese.php.
Your should see the Chinese characters displayed correctly.
7. On the IE window, baddest card Appearance > Encoding. You should see Gb2312 is selected.
Still not harder to do, right? The key point is to use an editor that accordant with GB2312.
Characters of Assorted languages in Cord Literals
After traveling through the aloft examples, you should feel adequate now on how to handle
non-ASCII characters of any individual language. You accept a best of using UTF-8 or a language
specific encoding.
If you wish to accept characters of assorted languages in a individual PHP script, then you
have to use UTF-8 encoding. Actuality are the accomplish you can chase create a PHP Software in UTF-8
for a amount of languages.
1. On a Windows system, run Alpha > All Programs > Accessories > Notepad.
2. In Notepad, access the afterward PHP script:
<?php #HelpUtf8MultiLanguages.php
# Absorb (c) 2005 by Dr. Yang, http://www.yang.com/
#
print( <html> );
print( <meta http-equiv="Content-Type" .
content="text/html; charset=utf-8"/> );
print( <body> );
print( <b>Test</b><br/> );
print( English: Accost world!<br/> );
print( Spanish: Hola mundo!<br/> );
print( Korean: ???? ?? !<br/> );
print( Chinese: ????!<br/> );
print( </body> );
print( </html> );
?>
Again, you will some "?" in the aloft antecedent in this book. This is because my book is using ISO-8859-1
encoding.
(Continued on next part...)
|
print, characters, gb2312, encoding, chinese, notepad, content, helpgb2312chinese, string, editor, script, languages, ascii, literals, window, , print <, chinese characters, gb2312 encoding, < html, helpgb2312chinese php, < body, php script, yang com, http www, ascii characters, string literals, non ascii, www yang, < body print, non ascii characters, content type content, type content text, text html charset, equiv content type, content text html, meta http equiv, compatible with gb2312, tutorials tutorial notes, < html print, < meta http, php tutorials tutorial, http equiv content, |
Also see ...
i(Continued from antecedent part...)/i3. Don t try to access those accost letters yourself. Go to the Google accent apparatus site,http://www.google.com/language_tools. You can access "Hello world!" and construe it to a
This affiliate explains:Storing Non ASCII Characters in DatabaseTransmitting Non ASCII Characters to the ServerMySqlUnicode.php UTF 8 Sample Script/ul
i(Continued from antecedent part...)/iTransmitting Non ASCII Characters to the ServerHandling non ASCII characters with MySQL not alone requires us ambience up the table columns
i(Continued from antecedent part...)/iIf you run it, you will get: Default settings... character_set_client latin1 character_set_connection latin1 character_set_data
This affiliate explains:What Is Localization / Internationalization?Managing Characters in Web Based Applications Character Traveling PathsASCII Char
i(Continued from antecedent part...)/iCharacter Traveling PathsIn a archetypal Web based application, characters will biking from one allotment of the appliance to addition part. b
i(Continued from antecedent part...)/iASCII Characters in PHP PagesAs I mentioned earlier, ASCII characters can biking from PHP files to browsers easily after any trouble. Ac
This affiliate explains:"mbstring" Extension"mbstring" Functions"mbstring" Basal TestsHTTP Ascribe and Achievement Encodingb
i(Continued from antecedent part...)/i"mbstring" Basal TestsI wrote the afterward Software to analysis some of the "mbstring" basal functions, MbStringBasic.php:p
i(Continued from antecedent part...)/iI you run it directly, you will get: Current settings: internal_encoding = (UTF 8) http_input = () http_output = (pass) func_