Fix encoding on locales with non-arabic digits (as Hindi (India))#3
Fix encoding on locales with non-arabic digits (as Hindi (India))#3dampcake merged 2 commits intodampcake:masterfrom
Conversation
| if (s == null) throw new NullPointerException("s cannot be null"); | ||
|
|
||
| return String.format("%d%s%s", s.length(), Bencode.SEPARATOR, s); | ||
| return String.format("%s%s%s", Integer.toString(s.length()), Bencode.SEPARATOR, s); |
There was a problem hiding this comment.
What does this do? When would s.legnth() ever return anything that would need to be toString'd?
There was a problem hiding this comment.
String.format("%d", ...) uses locale digits.
Integer.toString(...) uses "normal" digits.
Or locale may be set on method calls: String.format(Locale.ENGLISH, "%d", ...).
There was a problem hiding this comment.
Makes sense. I think I would rather use the Locale.ENGLISH solution as that looks to be the more accepted solution. Also if you could update the BencodeOutputStreamTest to run parameterized with all the locales that would be awesome!
…tStreamTest (tests on all available locales).
|
I was hoping to get this released to maven today. Looks like it will take a little while longer (troubleshooting with sonatype right now). For now you can use the SNAPSHOT if you need it right away. |
Unit tests for Bencode on different locales (if needed):