-
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
Garbled Unicode input #41
Comments
Oh, I made some progress by converting it to UTF-8.
Logs show it correctly:
But still getting an abort() at Error message.
|
Which build and easy-api version are you using? |
I'm using easy-api.js from the 0.3.0 release, and the liblouis-build is from commit-b78eff. |
Have you seen issue #3? We are passing UCS-2 as UTF-8 into liblouis, which is implemented here for 16bit builds and here for 32bit builds. I would be happy to accept a pull request that adds a proper conversion :) I am currently however not 100% positive thats your issue. |
Actually, I was using NPM to get the "latest" build, before you asked me what version I was using. So it was actually 0.2.0 easy-api with some older liblouis-build. Realizing I was using an older build, I downloaded 0.3.0 and commit-b78eff. It was still giving me an error, so I removed the UTF-8 encoding and passed in the string directly again. And it's now working! |
I can actually reproduce the issue using v0.4.0/master branch. I am keeping this issue open. Code for reproduction: <!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-utf16.js"
});
louAsync.enableOnDemandTableLoading("node_modules/liblouis-build/tables/", function() {});
louAsync.setLogLevel(louAsync.LOG.ALL, function() {});
louAsync.registerLogCallback(function(logLevel, msg){
console.log(logLevel, msg);
});
louAsync.version(function(version) {
console.info("Liblouis Version:", version);
})
louAsync.translateString(
['controlchars.cti','unicode.dis','vi-g1.ctb'].join(','),
'Trăm năm trong cõi người ta', function(msg) { console.log(msg); }
);
</script> Chrome Dev Tools Log:
|
Testing on 0.4.0 with liblouis-build#commit-4c8fbf translateString works: "Trăm năm trong cõi n\n"
But as soon as I add the letter
I tried stripping out line breaks and just simplifying to the "Trăm năm trong cõi ngư"
And then it breaks as soon as I added "Trăm năm trong cõi ngườ"
|
I don't know what happened. So I was running easy-api.js that I manually copied over so I can edit it, and got the abort error above. Just for curiosity, I disabled these four lines inside the
And I was able to get it to translate without an abort! Then I restored those lines and... it was able to run just fine without an abort. This makes no sense! I mean, it's working now, but it does bother me when something just starts working without a logical explanation, because we'll never know if the bug resurfaces. Anyway, I have a working single-page app at Right now I copy over the files from liblouis-build into my own folder, so ideally I would migrate over to using 0.4.0's EasyApiAsync and just have Webpack automatically copy over the necessary files into the production build. One bug at a time. 🐛 |
I'm running this:
My logs show this:
It looks like it can't take in Unicode characters directly. Any thoughts on how to best handle this?
The text was updated successfully, but these errors were encountered: