diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2005-04-16 05:09:33 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2005-04-16 05:09:33 +0000 |
commit | c17dc661eae89cea66959fad4fe48d77f1faf174 (patch) | |
tree | 1909b4157137e66b3f74adc75ca1a2bbf3bc3c6f /riscos/ucstables.c | |
parent | 37a4119ab80b1a7c7e37707c4e029218bdcbe549 (diff) | |
download | netsurf-c17dc661eae89cea66959fad4fe48d77f1faf174.tar.gz netsurf-c17dc661eae89cea66959fad4fe48d77f1faf174.tar.bz2 |
[project @ 2005-04-16 05:09:32 by jmb]
Split out UTF-8 handling functions.
Submit URL-encoded forms in sensible encoding:
* First entry in accept-charset list, if present
* Document encoding, otherwise
We may want to explicitly look for UTF-8, to save converting.
Convert cnv_str_local_enc/cnv_local_enc_str to use iconv (they're now veneers for utf8_[to/from]_enc).
Provide mechanism for looking up local system charset (derived from system alphabet, under RISC OS)
svn path=/import/netsurf/; revision=1647
Diffstat (limited to 'riscos/ucstables.c')
-rw-r--r-- | riscos/ucstables.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/riscos/ucstables.c b/riscos/ucstables.c index 3dc38e066..b744e9c6a 100644 --- a/riscos/ucstables.c +++ b/riscos/ucstables.c @@ -9,8 +9,10 @@ * UCS conversion tables */ +#include "oslib/osbyte.h" #include "oslib/territory.h" #include "netsurf/riscos/ucstables.h" +#include "netsurf/utils/utils.h" /* Common values (ASCII) */ #define common \ @@ -331,3 +333,42 @@ int *ucstable_from_alphabet(int alphabet) return ucstable; } + +static const char *localencodings[] = { + "ISO-8859-1", /* BFont - 100 - just use Latin1, instead */ + "ISO-8859-1", /* do we want to use Acorn Latin1, instead? */ + "ISO-8859-2", + "ISO-8859-3", + "ISO-8859-4", + "ISO-8859-5", + "ISO-8859-6", + "ISO-8869-7", + "ISO-8859-8", + "ISO-8859-9", + "ISO-IR-182", + "UTF-8", + "ISO-8859-15", + "ISO-8859-10", + "ISO-8859-13", + "ISO-8859-14", + "CP866" /* Cyrillic2 - 120 */ +}; + +/** + * Retrieve local encoding name, suitable for passing to iconv + */ +const char *local_encoding_name(void) +{ + os_error *error; + int alphabet; + + error = xosbyte1(osbyte_ALPHABET_NUMBER, 127, 0, &alphabet); + if (!error) { + if (alphabet < 116) + return localencodings[alphabet - 100]; + else if (alphabet == 120) + return localencodings[16]; + } + + return localencodings[0]; +} |