else if (!CYGetOffset(pool, context, property, offset))
return NULL;
- return CYCastJSValue(context, CYJSString(CYUTF8String(&internal->value_[offset], 1)));
+ uint16_t value(uint8_t(internal->value_[offset]));
+ return CYCastJSValue(context, CYJSString(CYUTF16String(&value, 1)));
} CYCatch(NULL) }
static bool CString_setProperty(JSContextRef context, JSObjectRef object, JSStringRef property, JSValueRef value, JSValueRef *exception) { CYTry {
else if (!CYGetOffset(pool, context, property, offset))
return false;
- const char *data(CYPoolCString(pool, context, value));
- internal->value_[offset] = *data;
+ auto data(CYCastUTF16String(CYJSString(context, value)));
+ _assert(data.size == 1);
+ internal->value_[offset] = data.data[0];
return true;
} CYCatch(false) }
case '\t': str << "\\t"; break;
case '\v': str << "\\v"; break;
+ case '\a':
+ if (mode == CYStringifyModeNative)
+ str << "\\a";
+ else goto simple;
+ break;
+
case '\n':
if (!split)
str << "\\n";
break;
case '\0':
- if (value[1] >= '0' && value[1] <= '9')
+ if (mode != CYStringifyModeNative && value[1] >= '0' && value[1] <= '9')
str << "\\x00";
else
str << "\\0";
default:
if (next >= 0x20 && next < 0x7f) simple:
str << *value;
+ else if (mode == CYStringifyModeNative)
+ str << "\\x" << std::setbase(16) << std::setw(2) << std::setfill('0') << unsigned(*value & 0xff);
else {
unsigned levels(1);
if ((next & 0x80) != 0)