[webkit-help] Pushing binary data into a string (JSStringCreateWithCharacters, JSStringCreateWithUTF8CString)
ewmailing at gmail.com
Fri Jun 5 05:39:46 PDT 2015
Curl callbacks for data give back a char* buffer, which may be a
string or binary data. I want to push this data directly into
handling and the usually the typical usage is a non-binary string. And
data and don't suffer from the C terminator problem.
Since I have a char* buffer, JSStringCreateWithUTF8CString() has the
right type signature, but it assumes null termination and there isn't
a variation with an explicit size parameter. This is problematic if
either there is no NULL terminator or there are 0's in the data
JSStringCreateWithCharacters has a parameter for the number of
characters, but it uses a JSChar* instead of char*. I don't know how
Is there a way I can get this through the bridge correctly?
P.S. For my callback bindings, I found the API
JSContextGetGlobalContext() invaluable. I found an old archived thread
suggesting it might be officially moved to public API. If it has not
already been moved, I would really like encourage this.
More information about the webkit-help