Developer's Guide : Backend
Backend Guide: Pages
introduction
integrating CPAINT
implementation differences
generating XML
complex return-data
arbitrary character encodings
Arbitrary Character Sets
Whether you use UTF-8, ISO-8859-1 or more complex character sets like hebrew, arabic, russian or japanese, CPAINT will support them. This means you don't have to worry about character conversion, not about the encoding your visitors browsers use, not about anything.
However you should take care that the Webpage uses the correct Content-type meta tag not to give the browsers a hard time.
The CPAINT frontend works in UTF-8 data wherever possible and will obey the Content-type everywhere else. This means that:
» data sent to the CPAINT backend will be submitted as UTF-8.
» data from the CPAINT backend will be converted into UTF-8.
Note that browsers do not have a problem displaying a UTF-8 text in a hebrew (...) website.
The CPAINT backend works slightly different in every implementation due to language specifics.
For PHP this means that:
» By default it assumes the character set to be UTF-8.
» If another character set is used CPAINT must be told so via cpaint.start().
» CPAINT will make use of the iconv library to convert backend data to UTF-8 before sending it
to the frontend wherever possible.
If iconv is not installed,
» If the character set is ISO-8859-1, utf8_encode() will be utilized.
» If neither is the case, data will be sent as-is.
» The same logic is applied to incoming frontend data (iconv, utf8_decode(), as-is).
» In any case the correct Content-type will be sent.
All backend implementations convert non-printable characters 0x00 - 0x20 as well as XML-sensitive characters & < > to representations safe for transmission as XML or plaintext and processing by the XMLHTTP object.
In the CPAINT frontend these representations are converted back to their original characters before the data is handed to the frontend application.
Thus, we have reason to believe that CPAINT is able to handle binary data, although this is currently untested.
Backend Framework Encodings
It is your responsibility as developer to determine the correct character encoding used by your backend applications and databases and feed that information to the CPAINT backend. Faulty encodings will in most cases lead to incorrect incoming / outgoing data, even to crashes of the XMLHTTP object in MSIE sometimes the reasons to which are both quite hard to debug and eliminate.