summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2005-07-16 14:35:25 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2005-07-16 14:35:25 +0000
commitf4ecaaed31db0aa5d71c05dd3f04dc2833ad29fe (patch)
tree362b09da27833d63b3ae7b8d9fd14a4b56e92243 /gtk
parent81a39c30755e9bb61a10a0edb16fec8996100024 (diff)
downloadnetsurf-f4ecaaed31db0aa5d71c05dd3f04dc2833ad29fe.tar.gz
netsurf-f4ecaaed31db0aa5d71c05dd3f04dc2833ad29fe.tar.bz2
[project @ 2005-07-16 14:35:20 by jmb]
- Convert Messages files to UTF-8 encoding. - Replace local_encoding_name() with platform specific utf8_[to,from]_local_encoding() functions - this allows mapping of 8bit characters 0x80->0x9f (inclusive). - All text that is rendered by the RISC OS Wimp is now converted to the system local encoding prior to display. - Lose the horrendous hack that was messages_get_key() - Menu text is now translated to system local encoding on the fly (if necessary) rather than at menu creation time. This allows the system alphabet to change under us and our menus remain usable. - The Languages menu now lists all languages that are present in the LangNames file. In the case of selecting the UI language, those languages which are not available are shaded. svn path=/import/netsurf/; revision=1796
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtk_gui.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/gtk/gtk_gui.c b/gtk/gtk_gui.c
index fe1db5042..151766aaf 100644
--- a/gtk/gtk_gui.c
+++ b/gtk/gtk_gui.c
@@ -5,6 +5,7 @@
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
*/
+#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -21,6 +22,7 @@
#include "netsurf/render/form.h"
#include "netsurf/render/html.h"
#include "netsurf/utils/messages.h"
+#include "netsurf/utils/utf8.h"
#include "netsurf/utils/utils.h"
@@ -163,4 +165,32 @@ void schedule_run(void) {}
void global_history_add(struct gui_window *g) {}
-const char *local_encoding_name(void) { return "UTF-8"; }
+utf8_convert_ret utf8_to_local_encoding(const char *string, size_t len,
+ char **result)
+{
+ assert(string && result);
+
+ if (len == 0)
+ len = strlen(string);
+
+ *result = strndup(string, len);
+ if (!(*result))
+ return UTF8_CONVERT_NOMEM;
+
+ return UTF8_CONVERT_OK;
+}
+
+utf8_convert_ret utf8_from_local_encoding(const char *string, size_t len,
+ char **result)
+{
+ assert(string && result);
+
+ if (len == 0)
+ len = strlen(string);
+
+ *result = strndup(string, len);
+ if (!(*result))
+ return UTF8_CONVERT_NOMEM;
+
+ return UTF8_CONVERT_OK;
+}