Skip to content
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

Parse fails on multibyte characters #22

Closed
Fire- opened this issue Mar 20, 2013 · 6 comments
Closed

Parse fails on multibyte characters #22

Fire- opened this issue Mar 20, 2013 · 6 comments

Comments

@Fire-
Copy link
Contributor

Fire- commented Mar 20, 2013

The parser doesn't appear to work with multibyte characters like asian char sets:

Error: Parse error on line 2:
...uluren0724","body":"拜託這場一定要放youtube "}
-----------------------^
Expecting 'eol', 'colon', 'char', 'space', got 'INVALID'
Error: Parse error on line 2:
...k":"akasim","body":"沒錯 機體強弱不說"}
-----------------------^
Expecting 'eol', 'colon', 'char', 'space', got 'INVALID'
Error: Parse error on line 2:
...k":"d40301","body":"我現在都看實況不玩遊戲"}
-----------------------^
Expecting 'eol', 'colon', 'char', 'space', got 'INVALID'
Error: Parse error on line 2:
...panjimmy","body":"28沒人"}
-----------------------^
Expecting 'eol', 'colon', 'char', 'space', got 'INVALID'
Error: Parse error on line 2:
...zero751210","body":"西葛格晚上好wwwww"}
-----------------------^
Expecting 'eol', 'colon', 'char', 'space', got 'INVALID'
/home/fire/programming_projects/js/node/test/node_modules/eventsource/lib/eventstream.js:58
    throw new Error(str);
          ^
Error: Parse error on line 2:
...,"body":"c'est pas 3€ les 1k viewers le 
-----------------------^
Expecting 'eol', 'colon', 'char', 'space', got 'INVALID'
    at Object.parseError (/home/fire/programming_projects/js/node/test/node_modules/eventsource/lib/eventstream.js:58:11)
    at Object.parse (/home/fire/programming_projects/js/node/test/node_modules/eventsource/lib/eventstream.js:110:22)
    at Object.exports.parse (/home/fire/programming_projects/js/node/test/node_modules/eventsource/lib/eventstream.js:363:56)
    at IncomingMessage.<anonymous> (/home/fire/programming_projects/js/node/test/node_modules/eventsource/lib/eventsource.js:85:40)
    at IncomingMessage.EventEmitter.emit (events.js:95:17)
    at IncomingMessage.<anonymous> (_stream_readable.js:699:14)
    at IncomingMessage.EventEmitter.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:382:10)
    at emitReadable (_stream_readable.js:377:5)
    at readableAddChunk (_stream_readable.js:142:7)
@aslakhellesoy
Copy link
Contributor

I'd be happy to take a patch for this and make a new release.

@Fire-
Copy link
Contributor Author

Fire- commented Mar 21, 2013

@aslakhellesoy I can't even understand the nearly unreadable mess that is the auto-generated parser, let alone write a patch for it, sorry :(

@aslakhellesoy
Copy link
Contributor

No point looking in the generated parser, it's not meant to be human readable. Instead, write a failing test for the parser and hack on the .jison source. Jison is well documented.

There is also a fork with the beginnings of a hand written parser that might prove useful.

@aslakhellesoy
Copy link
Contributor

Can you confirm that your stream uses characters in the allowed range?
http://www.w3.org/TR/eventsource/#parsing-an-event-stream

@aslakhellesoy
Copy link
Contributor

Run make

On Sat, Mar 23, 2013 at 6:25 AM, Devon Adkisson [email protected]:

How exactly do I run the tests in the first place?


Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-15332582
.

@Fire-
Copy link
Contributor Author

Fire- commented Mar 23, 2013

#23 fixes this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants