tags 606145 + patch kthxbye The problem here is that when writing out the file, we use fputs. fputs only operates on C strings and stops when it reaches a NUL byte. Of course, since UTF-16 is a double-byte character set, ASCII characters are encoded with one byte being 0 (NUL). The easy solution is to use fwrite with the byte count we get from and the attached patch does so.
-- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
diff -ur leafpad.old/src/file.c leafpad-0.8.17/src/file.c --- leafpad.old/src/file.c 2010-12-17 16:07:36.000000000 +0000 +++ leafpad-0.8.17/src/file.c 2010-12-17 16:14:39.000000000 +0000 @@ -228,7 +228,7 @@ GTK_MESSAGE_ERROR, _("Can't open file to write")); return -1; } - if (fputs(str, fp) == EOF) { + if (fwrite(str, 1, wbytes, fp) != wbytes) { run_dialog_message(gtk_widget_get_toplevel(view), GTK_MESSAGE_ERROR, _("Can't write file")); return -1;
signature.asc
Description: Digital signature