From 85a03a76c9035635ea4a6f87500c475b0c9bf931 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Fri, 10 Dec 2010 19:24:28 +0000 Subject: Fix STR #2348. Files encoded with UTF-8 or CP1252 are accepted. Any non-UTF-8-encoded data is interpreted according to CP1252 and transcoded to UTF-8. By default, a warning message is displayed when the input file was transcoded. This default behavior can be modified by changing a function pointer. A flag has been added to the Fl_Text_Buffer object that informs the caller if the input file was transcoded to UTF-8. The Fl_Text_Buffer.cxx file contains some preliminary code that could be used in the future to input other encodings provided they are fixed-length (e.g., all ISO-8859-* character sets, UTF-16). This code is not compiled at this point. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8004 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- test/editor.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/editor.cxx') diff --git a/test/editor.cxx b/test/editor.cxx index 6a920edae..92742ad48 100644 --- a/test/editor.cxx +++ b/test/editor.cxx @@ -492,6 +492,7 @@ void load_file(const char *newfile, int ipos) { int r; if (!insert) r = textbuf->loadfile(newfile); else r = textbuf->insertfile(newfile, ipos); + changed = changed || textbuf->input_file_was_reencoded; if (r) fl_alert("Error reading from file \'%s\':\n%s.", newfile, strerror(errno)); else @@ -795,6 +796,7 @@ Fl_Window* new_view() { int main(int argc, char **argv) { textbuf = new Fl_Text_Buffer; +//textbuf->transcoding_warning_action = NULL; style_init(); Fl_Window* window = new_view(); -- cgit v1.2.3