[xml] XML Characters encoding


I want to create an application (daemon) which is able to get user queries indicating its encoding, store them in a XML file, and then return the data to another user in another encoding.


        - User A sends a string in ASCII to the daemon
        - The daemon stores it in UTF-8 into a file
        - User B requests for the string in ISO-8859-1
        - The daemon reads the UTF-8 string and returns in ISO-8859-1

The solution that I thought was to have the daemon change its locale to ASCII on user A query (with setlocale (LC_ALL, "en")). Then, convert from ASCII to UTF-8 and set into the XML file. When user B queries for the string, change the locale to ISO-8859-1, grab the XML data and return to B.

Please note that ASCII and ISO-8859-1 are just examples, I want to use it with other encodings.

Any suggestions ? Thanks in advance.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]