Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTF8 from V8 not working #63

Open
jeena opened this issue May 5, 2011 · 5 comments
Open

UTF8 from V8 not working #63

jeena opened this issue May 5, 2011 · 5 comments

Comments

@jeena
Copy link

jeena commented May 5, 2011

Hi,

When I do this:

    {ok, Ret} = erlv8_vm:run(VM, "(function() { return 'ä' })()"),
    erlang:display(Ret),
    % "?"

I get a questionmark instead of the umlaut "ä", tried to find out why, at least V8 seems to be capable of using UTF8, but couldn't find anything.

@yrashk
Copy link
Member

yrashk commented May 5, 2011

Good catch. As far as I can tell for now, it most likely related to the fact that enif_make_string doesn't support anything beyond latin1. Will see what can be done to get around this limitation.

@jeena
Copy link
Author

jeena commented May 5, 2011

Hm but "ä" is in latin1.

@yrashk
Copy link
Member

yrashk commented May 5, 2011

Either way, will look into this.

On Thu, May 5, 2011 at 1:18 AM, jeena
[email protected]
wrote:

Hm but "ä" is in latin1.

Reply to this email directly or view it on GitHub:
#63 (comment)

@yrashk
Copy link
Member

yrashk commented Aug 27, 2011

Hi, sorry for a very long delay :)

I've made some improvements in the Unicode handling part, and this seems to work:

1> {ok, VM} = erlv8_vm:start().
{ok,<0.38.0>}
2> Global = erlv8_vm:global(VM).
{erlv8_object,<<>>,<0.38.0>}
3> Global:set_value("a", unicode:characters_to_binary("ä")).
<<"ä">>
4>  {ok, Ret} = erlv8_vm:run(VM, "(function() { return a })()").  
{ok,<<"ä">>}
5> io:format("~ts~n",[Ret]).
ä

Is this of any use?

@jeena
Copy link
Author

jeena commented Aug 31, 2011

Yeah that looks nice :) I don't have the time now to test it myself, but I will add it to my todo list, thanks for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants