ConvertCharset-- 1.0 2004-07-28 --
-- The most important thing -- I want to thank all people who helped me fix all bugs, small and big once. I hope that you don't mind that your names are in this file.
-- Some Apache issues -- I get info from Lukas Lisa, that in some cases with special apache configuration you have to put header() function with proper encoding to get your result displayed correctly. If you want to see what I mean, go to demo.php and demo1.php
-- BETA 1.0 2003-10-21 --
-- You should know about... -- For good understanding this class you shouls read all this stuff first :) but if you are in a hurry just start the demo.php and see what's inside.
I have made this class because I had a lot of problems with diferent charsets. First because people from Microsoft wanted to have thair own encoding, second because people from Macromedia didn't thought about other languages, third because sometimes I need to use text written on MAC, and of course it has its own encoding :)
Notice & remember:
DEBUG_MODE
You can set this value to:
CONVERT_TABLES_DIR
This is a place where you store all files with charset encodings. Filenames should have the same names as encodings. My advise is to keep existing names, because thay were taken from unicode.org (www.unicode.org), and after update to unicode 3.0 or 4.0 the names of files will be the same, so if you want to save your time...uff, leave the names as thay are for future updates.
The directory with edings files should be in a class location directory by default, but of course you can change it if you like.
Located in /includes/core.classes.php (line 3139)
string
Convert
(string $StringToChange, string $FromCharset, string $ToCharset, [boolean $TurnOnEntities = false])
ConvertCharset::Convert()
This is a basic function you are using. I hope that you can figure out this function syntax :-)
ConvertCharset::DebugOutput()
This function is not really necessary, the debug output could stay inside of source code but like this, it's easier to manage and translate. Besides I couldn't find good coment/debug class :-) Maybe I'll write one someday...
All messages depend on DEBUG_MODE level, as I was writing before you can set this value to:
ConvertCharset::HexToUtf()
This simple function gets unicode char up to 4 bytes and return it as a regular char. It is very similar to UnicodeEntity function (link below). There is one difference in returned format. This time it's a regular char(s), in most cases it will be one or two chars.
CharsetChange::MakeConvertTable()
This function creates table with two SBCS (Single Byte Character Set). Every conversion is through this table.
You can get full tables with encodings from http://www.unicode.org
CharsetChange::NumUnicodeEntity()
Unicode encoding bytes, bits representation. Each b represents a bit that can be used to store character data.
IMPORTANT: Remember that $UnicodeString input CANNOT have single byte upper half extended ASCII codes, why? Because there is a posibility that this function will eat the following char thinking it's miltibyte unicode char.
Documentation generated on Mon, 05 May 2008 16:18:59 +0400 by phpDocumentor 1.4.0