-
Notifications
You must be signed in to change notification settings - Fork 4
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
Translating numbers and spaces throws error with en-ueb-g2 #50
Comments
I'm sorry, I can't answer this question. Reiner can. I don't know of any bug like this in the core library. Translating the string "1 2 3" using standard command line tools works fine, so it must be something in the JS bindings. |
I can reproduce this using
The progam crashes while trying to free memory of the output buffer of translateString. The issue does not occur if you use a utf32 build instead of a utf16 build: <!doctype html>
<script src="node_modules/liblouis/easy-api.js"></script>
<script>
louAsync = new LiblouisEasyApiAsync({
easyapi: "node_modules/liblouis/easy-api.js",
capi: "node_modules/liblouis-build/build-no-tables-utf32.js"
});
louAsync.enableOnDemandTableLoading("node_modules/liblouis-build/tables/", function() {});
louAsync.setLogLevel(LiblouisEasyApi.prototype.LOG.ALL, function() {});
louAsync.registerLogCallback(function(logLevel, msg){
console.log(logLevel, msg);
});
louAsync.version(function(version) {
console.info("Liblouis Version:", version);
})
louAsync.translateString(
['unicode.dis', 'en-ueb-g2.ctb'].join(","),
'1 2 3', function(msg) { console.log("RESULT:", msg); }
);
</script> produces:
Using the 16bit build we get the correct result, but freeing the C memory of the result after copying it into Javascript fails:
|
I'm having issues translating simple strings that contain numbers and spaces. It is hard to identify a pattern regarding what exactly causes the error. One example is the string "1 2 3".
The above code has this output:
Oddly enough, the string "1 2" does work.
Any idea what could be causing this problem? Is this a known bug or a misuse of the api?
Thanks
Update: we tested the C liblouis library using the docker container referenced in the docs. The string "1 2 3" does indeed work with the C version, so this seems to be a problem specific to the javascript build.
The text was updated successfully, but these errors were encountered: