in reply to Re^5: Print unicode strings to pdf
in thread Print unicode strings to pdf
When I display this in an html input field, it displays:{ "hex_code":"\\xa5" }
After much googling with the right keywords, I found a solution by passing the value "\\xa5" (which originates from perl) to the function below:\xa5
I think it's somewhat similar to your perl code below://https://stackoverflow.com/questions/4209104/decoding-hex-string-in-j +avascript String.prototype.decodeEscapeSequence = function() { return this.replace(/\\x([0-9A-Fa-f]{4})/g, function() { return String.fromCharCode(parseInt(arguments[1], 16)); }); };
I am confused because when I have a variable set to a hex value in Javascript like this:sub unescape { my( $str ) = @_; $str =~ s!\\x\{([0-9a-f]{4})\}!chr(hex $1)!ge; $str };
That gets displayed correctly in the input field as a symbol.var hex_code = '\xa5';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Print unicode strings to pdf
by Corion (Patriarch) on Mar 27, 2018 at 09:00 UTC |