Webmaster Forum
Go Back   Webmaster Forums UK SEO SEM Webmaster Community Forum - UKWW > General > General Webmaster Talk
Register FAQ Members List Downloads Calendar Today's Posts Webmaster Resources Webmaster Blogs

UK Web Hosting
UK Web Hosting
Website Hosting
Website Hosting
UK One Way
UK One Way
Free Website Thumbnail Creator
 
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-30-2005, 05:54 PM
clau
Guest
 
Posts: n/a
iTrader: / %
Default ISO to UTF-8 Tutorial

Searching the web for a problem I face on a greek site about encoding, I found a very useful PHP class which changes the charset of a variable.

First of you all you have to download the class from here:
http://mikolajj.republika.pl/files/ConvertCharset/ConvertCharset_v1.0.zip .

Secondly, unzip the file and upload to your /www/ folder the ConvertTables dir and the ConvertCharset.class.php .

Open your php script you want to change the encoding.
Add to the line #1 the next code:

ob_start();
include("ConvertCharset.class.php");
?>

Then, go to the last line of your script and add:

$contents = ob_get_contents(); // store buffer in $contents
ob_end_clean(); // delete output buffer and stop buffering
$FromCharset = "iso-8859-7";
$ToCharset = "utf-8";
$text = new ConvertCharset();
$contents= $text ->Convert($contents, $FromCharset, $ToCharset);
echo "$contents";
?>

Don't forget to change the meta tag charset to UTF-8 to work properly.

Here is the list charsets you can operate with. The main requirement is that a character has to be in both character sets, otherwise it will return an error.

WINDOWS
windows-1250 - Central Europe
windows-1251 - Cyrillic
windows-1252 - Latin I
windows-1253 - Greek
windows-1254 - Turkish
windows-1255 - Hebrew
windows-1256 - Arabic
windows-1257 - Baltic
windows-1258 - Viet Nam
cp874 - Thai - this file is also for DOS


DOS
cp437 - Latin US
cp737 - Greek
cp775 - BaltRim
cp850 - Latin1
cp852 - Latin2
cp855 - Cyrylic
cp857 - Turkish
cp860 - Portuguese
cp861 - Iceland
cp862 - Hebrew
cp863 - Canada
cp864 - Arabic
cp865 - Nordic
cp866 - Cyrylic Russian (this is the one, used in IE "Cyrillic (DOS)" )
cp869 - Greek2


MAC (Apple)
x-mac-cyrillic
x-mac-greek
x-mac-icelandic
x-mac-ce
x-mac-roman


ISO (Unix/Linux)
iso-8859-1
iso-8859-2
iso-8859-3
iso-8859-4
iso-8859-5
iso-8859-6
iso-8859-7
iso-8859-8
iso-8859-9
iso-8859-10
iso-8859-11
iso-8859-12
iso-8859-13
iso-8859-14
iso-8859-15
iso-8859-16


MISCELLANEOUS
gsm0338 (ETSI GSM 03.38)
cp037
cp424
cp500
cp856
cp875
cp1006
cp1026
koi8-r (Cyrillic)
koi8-u (Cyrillic Ukrainian)
nextstep
us-ascii
us-ascii-quotes

DSP implementation for NeXT
stdenc
symbol
zdingbat
Digg this Post!Add Post to del.icio.usStumble this Post!Wong this Post!
Reply With Quote
Reply

Bookmarks

Webmaster Resources
UK Web Hosting
UK WW SEO Tools
Free site submission
Web Directory
 
Advertisement
Get top 10 exposure
 
Site Of the Month
BizzFace
Nominate site of the month
 
Tag Cloud
2 columns admins wanted advice ajax article submistion bbpress best site bid bidding directory blog post butterflies chip maker coda concentration coupon code directories submission directory directory network domain for sale domain name dzone ecommerce ecommerce poll forum forum posting free free download free web hosting generate revenue google google serps icq instant messenger intel internet internet spending james in london jokes keywords limitations lightbox linux and windows server microsoft mod modeling monopoly mootools msn music online newbie nominate online spending owg in london paid forum posting photography php review review website scripts search engine seo site promotion skype social bookmarking submission theme web hosting win a network wordpress xhtml yahoo

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
mod_rewrite simple tutorial melkior_inactive Programming 15 01-14-2008 10:17 PM
HTML Layout Tutorial Scripter General Webmaster Talk 4 11-01-2007 08:39 PM
Tutorial competition Bagi Zoltán Community Fun Area 17 06-26-2007 03:38 PM
Tutorial Contest host2design Community Fun Area 9 07-27-2005 10:09 PM
Tutorial Index crowebird General Webmaster Talk 3 04-29-2005 08:28 PM


All times are GMT. The time now is 10:58 PM.

UK Webmaster World Forums - Internet marketing, web development, domain names, SEO contest and discussuons.
Subscribe to our feeds   Subscribe to our feeds

Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151