PHP Tutorials - Tutorial Addendum - Non ASCII Characters as Cord Literals

 31 December 18:00   

    



    



    

(Continued from antecedent part...)

    

3. To access the French character, "e with grave", you can run Alpha >

    

All Programs > Arrangement Accoutrement > Appearance Map. Baddest "e with grave" on the appearance map.

    

Click the Baddest button, then the Archetype button. Go aback to your Block and bang Ctrl-V

    

to adhesive "e wtih grave" into your PHP script.

    

4. Baddest card Book > Save as. Access the book name as HelpIsoFrench.php. Baddest "ANSI"

    

in the Encoding acreage and bang the Save button. Agenda that ANSI is encoding action authentic by Microsoft

    

and acclimated on Windows system. ANSI contains added characters than ISO-8859-1. But it is accordant with ISO-8859-1.

    

5. Archetype HelpIsoFrench.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/HelpIsoFrench.php.

    

Your should see the French characters displayed accurately as apparent below:

    

 

    

Help

    

English: Arrangement amount is actual high.

    

French: L utilisation de systme est trs haute.

    



    

7. On the IE window, baddest card Appearance > Encoding. You should see "Western European" is selected.

    

Again "Western European" is a altered name for ISO-8859-1.

    

Easy to do, right? We could create it even easier. You can abolish the <meta> tag ambience in

    

HelpIsoFrench.html. French characrters will still appearance up on the IE window. This is because ISO-8859-1

    

is the absence encoding action to IE.

    



    



    

Chinese Characters in Cord Literals - UTF-8 Encoding

    

Now let s play with Chinese characters. They are absolutely harder to plan with than French characters.

    

My first archetype shows you how to handle Chinese characters in PHP scripts with UTF-8 encoding.

    



    

1. On a Windows system, run Alpha > All Programs > Accessories > Notepad.

    

2. In Notepad, access the afterward HTML document:

    

 

    

<?php #HelpUtf8French.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>??</b><br/> );

    

print( ????????????<br/> );

    

print( </body> );

    

print( </html> );

    

?>

    



    

When I archetype this HTML certificate into this book, I accept to alter all UTF-8 encoded Chinese characters

    

with "?"s, because my book is accounting in HTML certificate with the absence encoding schema. To chase my tutorial,

    

just access any Chinese appearance whenever you see "?".

    

3. As I mentioned beforehand in this book, entering Chinese characters is not an simple job.

    

You charge to use a Chinese Windows system, or a Chinese ascribe apparatus on a non-Chinese Windows system.

    

If you don t accept any Chinese ascribe tool, you can artlessly go to the Beast Chinese Web site, http://www.yahoo.com.cn/,

    

copy some Chinese characters, and adhesive them into Notepad. The Beast Chinese Web website is encoded in UTF-8.

    

4. Baddest card Book > Save as. Access the book name as HelpUtf8Chinese.php. Baddest "UTF-8"

    

in the Encoding acreage and bang the Save button.

    

5. Archetype HelpUtf8Chinese.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/HelpUtf8Chinese.php.

    

Your should see the Chinese characters displayed correctly.

    

7. On the IE window, baddest card Appearance > Encoding. You should see UTF-8 is selected.

    

(Continued on next part...)

    



    



    

 


Tags: internet, information, system, windows, service, chinese, character, characters, french, window, click, button, displayed, yahoo, notes, document, string, tutorial, tutorials, print

 chinese, characters, encoding, select, print, system, french, windows, default, helpisofrench, internet, notepad, click, character, button, string, yahoo, helputf8chinese, document, window, grave, tutorial, schema, literals, , chinese characters, print <, web site, iso 8859, windows system, select menu, click the, helputf8chinese php, html document, string literals, helpisofrench php, encoding schema, menu view encoding, select menu view, window select menu, default encoding schema, < body print, chinese input tool, chinese windows system, characters displayed correctly, php your should, select menu file, non ascii characters, tutorials tutorial notes, menu file save, inetpubwwwroot make sure, internet information service, sure your internet, php tutorials tutorial,

Share PHP Tutorials - Tutorial Addendum - Non ASCII Characters as Cord Literals:
Digg it!   Google Bookmarks   Del.icio.us   Yahoo! MyWeb   Furl  Binklist   Reddit!   Stumble Upon   Technorati   Windows Live   Bookmark

Text link code :
Hyper link code:

Also see ...

Permalink
Article In : Computers & Technology  -  php