-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Add full UTF-8 support to RPC #7892
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
Conversation
|
Nice! Not sure how we should treat the UniValue changes. Should we try to keep the "upstream" repository bitcoin/univalue in sync? |
|
Concept ACK. Tests look good.
The patch goes to jgarzik/univalue as bitcoin/univalue is only for bitcoin related patches. (Still in the end we need to merge jgarzik/univalue into bitcoin/univalue because we use this as subtree.) |
7a7afa2 to
09cce63
Compare
09cce63 to
0ef6abf
Compare
|
Neat. What happens with characters like unicode direction modifiers? Can you end up with your terminal in a weird state? |
qa/rpc-tests/wallet.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs rebase.
I don't think that's possible with just unicode? ANSI escape sequences are a whole different story. In JSON objects they'll be escaped, but when printing strings (say, for Nothing new here though: It's always been possible to pass any kind of crap characters from the server (just look at my OP) to bitcoin-cli, this just makes the round-trip sane and conform to UTF-8. |
|
concept ACK, once-over utACK (did not cross-verify UTF-8 impl.). Could probably use more tests for that JSONUTF8Writer... |
There are few direct tests for it, but all the other tests that parses JSON with strings in it is testing it. |
|
@pstratem Any interest in fuzzing this? |
|
Needs rebase. |
0ef6abf to
0912569
Compare
|
Rebased, done and removed the Python3 TODOs |
f32df99 Merge branch '2016_04_unicode' into bitcoin 280b191 Merge remote-tracking branch 'jgarzik/master' into bitcoin c9a716c Handle UTF-8 bed8dd9 Version 1.0.2. 5e7985a Merge pull request bitcoin#14 from laanwj/2015_11_escape_plan git-subtree-dir: src/univalue git-subtree-split: f32df99e96d99ab49e5eeda16cac93747d388245
Add a setting ensure_ascii to AuthServiceProxy. This setting, defaulting to True (backwards compatible), is passed through to json.dumps. If set to False, non-ASCII characters >0x80 are not escaped. This is useful for testing server input processing, as well as slightly more bandwidth friendly in case of heavy unicode usage.
0912569 to
7982fce
Compare
|
Ok:
This should be ready now. |
|
ACK |
7982fce doc: Mention full UTF-8 support in release notes (Wladimir J. van der Laan) 6bbb4ef test: test utf-8 for labels in wallet (Wladimir J. van der Laan) a406fcb test: add ensure_ascii setting to AuthServiceProxy (Wladimir J. van der Laan) 60ab9b2 Squashed 'src/univalue/' changes from 2740c4f..f32df99 (Wladimir J. van der Laan)
|
It looks like the build system doesn't detect changes to univalue source files and will not automatically rebuild the library: if you get RPC test failures concerning unicode, please build from a clean tree |
make clean
make distcleanshould take care of this, I assume. |
|
Yes, |
This was probably missed while backporting Bitcoin PR bitcoin#7892
This was probably missed while backporting Bitcoin PR bitcoin#7892
(the univalue patch should be taken upstream - the RPC test and doc change should end up here. Posting it here for visibility and because this fixes an ancient issue: #2127. I think this is important to many non-English users)
This adds full UTF-8 support for both on input and output through JSON.
bitcoin-cli usage
Before:
After:
GUI
This also affects the GUI debug console.
Before:
When strings are passed directly (such as for getaccount's return argument) it works fine, but when they go through JSON formatting/parsing, it fails.
After:
RPC test
A test for this new functionality has been added to the
wallet.pytest.See the commit message of the first commit for details on what exactly had to be changed in univalue.