Closed k8si closed 10 years ago
This occurs when you try to convert part of a buffer into a unicode string, when it is an invalid unicode string (using Buffer's toString('utf8',...)
).
Not all bit patterns are valid unicode characters. Some implementations inject garbage characters when this occurs (e.g. FileReader
in the browser), but BrowserFS will actually throw an exception. I chose to do this so it doesn't fail silently.
There should be a stack trace associated with the error, btw. If you are manually catching it and printing it out, you can print it through console.log(errorObject.stack);
.
Or, if you're in the browser, set a breakpoint using e.g. Chrome developer tools. You should be able to see TypeScript source in the browser if you pass the enable source maps flag to the TypeScript compiler (it'll generate .js.map
files).
I'm looking into this (just created an issue to remind me and puja to come back to it later tonight -- forgot that you probably get an e-mail when I do this...) but here's the stacktrace. It seems like it's happening when I try to test the parser on files that contain parentheses? e.g. I get the error after adding the line "k = d.keys()" to test_dict.py (where I didn't get it before).
Uncaught Error: Found incomplete part of character in string. string_util.js:416UTF8.byte2str string_util.js:416Buffer.toString buffer.js:458PyString py_objects.js:146Parser.read_object parse.js:146Parser.read_object parse.js:174Parser.parse parse.js:67exports.TestDict.http://localhost:3000/data/test_fxn.pyc test_suite.js:37TestSuite.test test_suite.js:47(anonymous function)
Sounds like your parser has a bug somewhere. If you have a way of debug printing how your interpreter parses the file, you could compare how it looks before/after that line?
Either way, you're trying to convert binary data into a UTF-8 string when it is not a proper UTF-8 string.
You were right (I think it was some combination of calling toString() later and not using Blob correctly), thanks
When trying to read it in, I get
Error: Found incomplete part of character in string.
Not sure why....