mixed encoding and Simpleentiy
Bas Kamer <[email protected]> Mon, 27 Jun 2005 03:23:53 +0200
| Newsgroups | gmane.comp.lib.binarycloud.devel |
|---|---|
| Message-ID | <[email protected]> |
hi jcm, Simpleentity translates the data on lading from the datasource encoding to the output incoding. I believe this is wrong. Firstly if there is a translator for getting data, then there should also be one for putting it back in the database. But my main point is that it should not translate to and from the output encoding but to the encoding that that particular Node is using. (Which is currently always UTF-8, see #219). Let me illustrate. We need to serve iso-8859-1 encoded html pages. There is a database in which the data is encoded in iso-8859-1. When binarycloud starts it sets internal encoding set to utf-8 and treats all variables as such. All templates, ndf, translation, php, etc... are utf-8. Even POST/GET values are translated to utf-8 (not cookies though) Binarycloud then sets output encoding to whatever is desired (iso-8859-1) and will initiate an output buffering session with the iconv_ob_handler parameter, all output send to the browser will first be encoded. Because SimpleEntity translates the data from the datasource encoding to the output encoding a Node potentially can receive iso-8859-1 data. If a Node would only save that data back into the database there is no trouble, but when the data travels to the browser it is first translated from utf-8 to iso-8859-1 andd then return via a POST operation, the then presumed iso data is translated back into utf-8 and then that is being save as utf-8 in a iso-8859-1 database. It seems to make more sense to translate it to utf-8 before SimpleEntity returns and data to the Node. Additionally it should then do the oposite translate from utf-8 to datasource encoding while saving data. I have tested this theory by adapting SimpleEntity and it seems to work... Please tell me what you think... I hope I make can make myself clear enough... Bas _______________________________________________ dev mailing list dev-PnctHDZWAvB/Cz2I37pSEPZ4XP/[email protected] http://lists.binarycloud.com/mailman/listinfo/dev