Skip to content

Issue with UTF-8 failing to decode hex bytes #2383

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

Closed
ghost opened this issue Jun 13, 2017 · 0 comments
Closed

Issue with UTF-8 failing to decode hex bytes #2383

ghost opened this issue Jun 13, 2017 · 0 comments
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Jun 13, 2017

Given the following raw hex string:

public constant notValid = hex"F09FA684";
Solidity throws the following error:

Type literal_string (contains invalid UTF-8 sequence at position 3) is not implicitly convertible to
expected type string memory.

However, given the valid series of UTF-8 encoded bytes \xF0\x9F\xA6\x84, Solidity should decode it to get the unicorn emoji: 🦄, a valid UTF-8 decoded character.

You can verify the desired behavior here,
entering \xF0\x9F\xA6\x84 into the UTF-8-encoded box.

This issue was discovered as the result of a StackExchange question, which you can find here .

Solidity 0.4.11
Related Files:
/libdevcore/UTF8.cpp [1071] - where error is thrown
/libsolidity/ast/Types.cpp [31] - validateUTF8() improperly returns false
OS: Ubuntu 16.04

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

No branches or pull requests

2 participants