diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-04-21 06:44:54 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-04-21 06:44:54 -0700 |
commit | f1f24ca5cfb5fde42405ee2ae3b53eb397e9133c (patch) | |
tree | 97960961f9dd1ef090e38f8395ccb3d82c4f7089 /utf8.c | |
parent | 0168c96019eb9247d0cf7453a9b6b6adad5c2905 (diff) | |
download | txr-f1f24ca5cfb5fde42405ee2ae3b53eb397e9133c.tar.gz txr-f1f24ca5cfb5fde42405ee2ae3b53eb397e9133c.tar.bz2 txr-f1f24ca5cfb5fde42405ee2ae3b53eb397e9133c.zip |
Diagnose out-of-range char to UTF-8 conversion.
* utf8.c (utf8_encode): Don't return zero in the
out-of-range case, but throw.
Diffstat (limited to 'utf8.c')
-rw-r--r-- | utf8.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -252,7 +252,9 @@ int utf8_encode(wchar_t wch, int (*put)(int ch, mem_t *ctx), mem_t *ctx) put(0x80 | (wch & 0x3F), ctx); } - return 0; + uw_throwf(error_s, + lit("cannot convert character value #x~x to UTF-8"), + num(wch), nao); } void utf8_decoder_init(utf8_decoder_t *ud) |