From eeb97d89c3de8a55de51a263dffa87cae558de34 Mon Sep 17 00:00:00 2001 From: Adrian Lees Date: Sat, 11 Feb 2006 19:10:42 +0000 Subject: [project @ 2006-02-11 19:10:42 by adrianl] Corrected UTF8 conversion of imported text svn path=/import/netsurf/; revision=2074 --- riscos/window.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/riscos/window.c b/riscos/window.c index 58a103255..00d6e3eea 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -2890,28 +2890,26 @@ bool ro_gui_window_import_text(struct gui_window *g, const char *filename, warn_user("NoMemory", NULL); return true; } + size = strlen(utf8_buf); if (toolbar) { - const char *ep = buf + size; + const char *ep = utf8_buf + size; const char *sp; char *p = utf8_buf; /* skip leading whitespace */ - while (p < ep && isspace(*p)) p++; + while (isspace(*p)) p++; sp = p; - while (p < ep) { - if (*p == '\n' || *p == '\r') break; + while (*p && *p != '\r' && *p != '\n') p += utf8_next(p, ep - p, 0); - } *p = '\0'; if (p > sp) ro_gui_window_launch_url(g, sp); } else - browser_window_paste_text(g->bw, utf8_buf, - strlen(utf8_buf), true); + browser_window_paste_text(g->bw, utf8_buf, size, true); free(buf); free(utf8_buf); -- cgit v1.2.3