Closed utopos closed 3 months ago
Created a PR here https://github.com/revelrylabs/elixir-nodejs/pull/77
From the README:
In order to cope with Unicode character it is necessary to specify the binary option:
NodeJS.call("echo", ["’"], binary: true) # => {:ok, "’"}
Hey, @29decibel thanks for filing the issue and PR, and sorry it's been sitting here so long without attention. If you're still interested in moving this forward, I'd be interested in your take on a couple of things:
binary: true
option addresses the example in the issue and the test case in your PR... are you aware of other cases that aren't addressed by the binary: true
option?binary: true
option by always passing the response through IO.iodata_to_binary()
?If the latter is the case, then it seems like something that'd make the library simpler and easier to use, though we'd want to be careful not to break other use cases that are currently working fine.
Thank you @grossvogel ! I missed this option then, I think we can close this PR. :-)
@utopos I'm going to close this under the understanding that the binary: true
option solves your needs. If that's not the case, please let me know!
Hi!
I have been trying the library (which is fantastic!) but I'm experiencing issues with characters encoding. If the return string from the called JS function contains UTF-8 characters, the return on Elixir side will be a binary.
Please, allow me to illustrate with en example with a letter "Ł":
Javascript:
Elixir:
Thank you!