summaryrefslogtreecommitdiffstats
path: root/generic/tclDisassemble.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2015-08-31 10:18:31 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2015-08-31 10:18:31 (GMT)
commit573f9fd80810dede88587f8ec61fb5cbb4a100b8 (patch)
tree12b8693432cf7df9939fe220010831b9e4e2e251 /generic/tclDisassemble.c
parent52eb2299f3995e1837bfa3bf899dba688a0db1dc (diff)
downloadtcl-573f9fd80810dede88587f8ec61fb5cbb4a100b8.zip
tcl-573f9fd80810dede88587f8ec61fb5cbb4a100b8.tar.gz
tcl-573f9fd80810dede88587f8ec61fb5cbb4a100b8.tar.bz2
Some Unicode encoding fixes, only having effect if TCL_UTF_MAX > 4. Backported from androwish
Diffstat (limited to 'generic/tclDisassemble.c')
-rw-r--r--generic/tclDisassemble.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c
index 0a325b3..15502e7 100644
--- a/generic/tclDisassemble.c
+++ b/generic/tclDisassemble.c
@@ -794,6 +794,7 @@ PrintSourceToObj(
{
register const char *p;
register int i = 0, len;
+ Tcl_UniChar ch = 0;
if (stringPtr == NULL) {
Tcl_AppendToObj(appendObj, "\"\"", -1);
@@ -803,7 +804,6 @@ PrintSourceToObj(
Tcl_AppendToObj(appendObj, "\"", -1);
p = stringPtr;
for (; (*p != '\0') && (i < maxChars); p+=len) {
- Tcl_UniChar ch;
len = TclUtfToUniChar(p, &ch);
switch (ch) {
@@ -832,6 +832,12 @@ PrintSourceToObj(
i += 2;
continue;
default:
+#if TCL_UTF_MAX > 4
+ if ((int) ch > 0xffff) {
+ Tcl_AppendPrintfToObj(appendObj, "\\U%08x", (int) ch);
+ i += 10;
+ } else
+#endif
if (ch < 0x20 || ch >= 0x7f) {
Tcl_AppendPrintfToObj(appendObj, "\\u%04x", ch);
i += 6;