Closed frankrausch closed 6 years ago
Can you give me an example of what you were encoding? I just tested with the string "é" and it went back and forth as expected:
é # run "Unicode to Hexadecimal"
\u00e9 # output
\u00e9 # run "Hexadecimal to Unicode"
é # output
Thanks for the quick reply!
Decoding and encoding é
worked as expected for me, too.
It did not work for "
, e
, and &
, for example.
Does the conversion only work for certain characters?
Ah gotcha, yes it currently only changes characters that are beyond the ASCII set (<0x80 aka 128
). Unicode is happy with those characters "as is", but if you wanted to modify the plugin to add this feature it would be easy, just replace the lines:
if tmp < 0x80:
hex_text += chr(tmp)
char_index = 0
elif tmp >= 0xd800 and tmp <= 0xdbff:
char_index += 1
with
if tmp >= 0xd800 and tmp <= 0xdbff:
char_index += 1
Ah, cool! Thanks a lot.
I guess for most use cases your approach is perfect and mine is more esotheric. :) So I’ll go ahead and modify the plugin as you suggested.
Cheers!
👍 Happy to help. And thanks for closing out the issue, I'm always surprised when people don't do that. 😃
Hi there,
love this plugin!
I’ve noticed that in recent Sublime Text 3 builds, the commands Unicode to Hexadecimal and Hexadecimal to Unicode have stopped working.
For example, if I select a character and use the command Unicode to Hexadecimal, it used to give me the hex representation like
\uXXXX
.Now it doesn’t do anything.
Sublime Text 3 (3156), SublimeStringEncode v2.2.2.
Thanks! Frank