diff --git a/source/simulation/EntityProperties.cpp b/source/simulation/EntityProperties.cpp index f37297d9bc..f5d49da501 100755 --- a/source/simulation/EntityProperties.cpp +++ b/source/simulation/EntityProperties.cpp @@ -115,7 +115,7 @@ void CBoundObjectProperty::set( const jsval value ) jsval CBoundObjectProperty::tojsval() { - return( STRING_TO_JSVAL( JS_NewUCStringCopyZ( g_ScriptingHost.getContext(), m_String.c_str() ) ) ); + return( STRING_TO_JSVAL( JS_NewUCStringCopyZ( g_ScriptingHost.getContext(), utf16().c_str() ) ) ); } CBoundObjectProperty::CBoundObjectProperty() diff --git a/source/simulation/scripting/JSInterface_Entity.cpp b/source/simulation/scripting/JSInterface_Entity.cpp index 9c3b4ba972..db57baadab 100755 --- a/source/simulation/scripting/JSInterface_Entity.cpp +++ b/source/simulation/scripting/JSInterface_Entity.cpp @@ -136,8 +136,10 @@ JSBool JSI_Entity::toString( JSContext* cx, JSObject* obj, uintN argc, jsval* ar HEntity* e = (HEntity*)JS_GetPrivate( cx, obj ); wchar_t buffer[256]; - _snwprintf( buffer, 256, L"[object Entity: \"%ls\" (%ls)]", (const wchar_t*)(*e)->m_name, (const wchar_t*)(*e)->m_base->m_name ); + swprintf( buffer, 256, L"[object Entity: \"%ls\" (%ls)]", (*e)->m_name.c_str(), (*e)->m_base->m_name.c_str() ); buffer[255] = 0; - *rval = STRING_TO_JSVAL( JS_NewUCStringCopyZ( cx, buffer ) ); + utf16_t utfbuf[256]; + std::copy(buffer, buffer+256, utfbuf); + *rval = STRING_TO_JSVAL( JS_NewUCStringCopyZ( cx, utfbuf ) ); return( JS_TRUE ); }