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

Invalid rune provided: πŸ€„ #7

Open
nival999 opened this issue Jan 29, 2019 · 12 comments
Open

Invalid rune provided: πŸ€„ #7

nival999 opened this issue Jan 29, 2019 · 12 comments

Comments

@nival999
Copy link

nival999 commented Jan 29, 2019

I keep getting the error "Invalid rune provided", but only for πŸ€„... Any idea how to fix this?

Also, separate issue quick fix, I am using binary data now after reading the issue about it, but it should be an option to set the encoding type for that part. There's no reason it should by default only decode binary data.... There should be a pass-inargument for that for both decode and encode. I tried to make a fork which implemented it but weirdly couldnt load the library any longer. So I ended up just converting all my data to binary data (difficult to find functions for it since Javascript didn't support binary data at all until only a few years ago).

@dimabory
Copy link
Owner

I keep getting the error "Invalid rune provided", but only for πŸ€„... Any idea how to fix this?

Please provide more info about what you try to do.

$ echo πŸ€„ | ecoji
πŸπŸŒ«πŸ†“πŸŠπŸ¦πŸ”¦πŸ“žπŸ‡ΊπŸŽ­πŸšΎπŸπŸŒ‡

@nival999
Copy link
Author

nival999 commented Jan 31, 2019

Sure. I'm running in the browser (Firefox) using browserify.

When I run this command:
ecoji.decode("πŸ€„")

It an error "Expected more than 4 emojis"

When I run this command: ecoji.decode("πŸ€„πŸ€„πŸ€„πŸ€„πŸ€„")

I get: Error: Invalid rune provided: πŸ€„

@biocrypto730
Copy link

biocrypto730 commented Feb 1, 2019

Do we know why this would be happening? lol. The unicode hex converter converts it to 1F004.

The behavior also happens in node, server-side.

@dimabory dimabory reopened this Feb 1, 2019
dimabory added a commit that referenced this issue Feb 1, 2019
@dimabory
Copy link
Owner

dimabory commented Feb 1, 2019

@nival999 @projectoblio Please check now

I've changed an error "Expected more than 4 emojis".
When you run ecoji.decode("πŸ€„πŸ€„πŸ€„πŸ€„πŸ€„") you will get "Unexpected emoji sequence provided."

@biocrypto730
Copy link

biocrypto730 commented Feb 1, 2019

But I only obtained the rune character by running emoji.encode in this library. So how could the library possibly be outputting a rune character after encoding if it can't decode it? I couldn't figure this out looking at the source. But this could be a major issue with the lib depending in the use case.

@dimabory
Copy link
Owner

dimabory commented Feb 4, 2019

As @nival999 mentioned in #7 (comment) the issue is caused by binary data encoding.

@biocrypto730
Copy link

biocrypto730 commented Feb 4, 2019

^ Thanks, but I think this is the comment you meant to link to: #6 (comment)

@dimabory
Copy link
Owner

dimabory commented Feb 5, 2019

^ Thanks, but I think this is the comment you meant to link to: #6 (comment)

As well as comment from #7 (comment)

So I ended up just converting all my data to binary data (difficult to find functions for it since Javascript didn't support binary data at all until only a few years ago).

@biocrypto730
Copy link

biocrypto730 commented Feb 5, 2019

If the problem is with Binary data, then it makes no sense to have this line inside Ecoji.ts:

const bufferIterator = Buffer.from(input.encode(), 'binary')

Why not allow the user to specify the input encoding, like @nival999 said? Defaulting to a non-functioning parameter makes no sense. This lib is a lot less useful if you require users to do that. I will try submitting a PR, sorry if this comment came off as negative

@dimabory
Copy link
Owner

dimabory commented Feb 6, 2019

If I leave Buffer.from without 'binary encoding it won't work as well. You can check by yourself if you wish.

@biocrypto730
Copy link

Can you help me write a decodeType function for hex? I can't figure out how to make the test work:

#9

@dimabory
Copy link
Owner

dimabory commented Feb 8, 2019

@projectoblio
Can you provide specific use-case of this PR #9 ?
Btw, I can't approve you PR without tests.

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

3 participants