Are you using Visual Studio? Try to save your source file with UTF8
encoding:

File -> Advanced Save Options



2009/9/11 Erik Corry <[email protected]>

>
> 2009/9/11 Cloudage <[email protected]>:
> >
> > here`s my code:
> >
> > using namespace v8;
> > int _tmain(int argc, _TCHAR* argv[])
> > {
> >        HandleScope handle_scope;
> >
> >        Persistent<Context> context = Context::New();
> >
> >        Context::Scope context_scope(context);
> >
> >        Handle<String> source = String::New("'你好'+',世界!'");
>
> See the comment in include/v8.h.  This call expects UTF-8 coded data,
> so it will work if your C++ code editor is set up to save in UTF-8
> mode.  I think only the basic plane (16 bit unicode characters) is
> supported at the moment, but it could conceivably be expanded to
> encode other Unicode characters into UTF-16 internal representation.
>
> >
> >        Handle<Script> script = Script::Compile(source);
> >
> >        Handle<Value> result = script->Run();
> >
> >        context.Dispose();
> >
> >        String::Utf8Value str(result);
> >        printf("%s\n", *str);
>
> This will work if your terminal is set up to accept UTF-8 as output.
> Again, I think only the first 65536 Unicode characters are supported
> at the moment.
>
> --
> Erik Corry, Software Engineer
> Google Denmark ApS.  CVR nr. 28 86 69 84
> c/o Philip & Partners, 7 Vognmagergade, P.O. Box 2227, DK-1018
> Copenhagen K, Denmark.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to