Artifacts Associated With Ticket 3063568fffffffffffffffffffffffffffffffff
Ticket change [188d6b6d88] (rid 122681) by jaspertheperson on 2010-09-10 11:57:18:
- assignee initialized to: "pvgoran"
- cmimetype initialized to: "text/plain"
- comment initialized to:
It's this one: =========================================== Convert all non-ASCII and Tcl-significant characters into \u escape sequences by using regsub and subst in combination: # This RE is just a character class for everything "bad" set RE {[][{};#\\\$\s\u0080-\uffff]} # We will substitute with a fragment of Tcl script in brackets set substitution {[format \\\\u%04x [scan "\\&" %c]]} # Now we apply the substitution to get a subst-string that # will perform the computational parts of the conversion. set quoted [subst [regsub -all $RE $string $substitution]] =========================================== The RE for "bad" characters includes \s which matches all whitespace characters including newline. However, inserting \ before newline before calling subst on a string containing it does not preserve the newline, it causes it to be replaced by a space, so the whole procedure replaces newlines with \u0020 Not sure how to get this to work properly! Little help? - foundin initialized to: "obsolete: 8.6b1"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "jaspertheperson"
- subsystem initialized to: "43. Regexp"
- title initialized to: "regsub example doesn't perform as advertized"
- type initialized to: "Bug"
Ticket change [bed1725dc3] (rid 102150) by dkf on 2010-09-10 19:43:52:
- assignee changed to: "dkf"
- icomment:
Good catch. Newlines need to be handled specially. :-(
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
Ticket change [a3f46d26f5] (rid 110130) by dkf on 2010-09-10 19:55:19:
- icomment:
Updated example text is as below. # This RE is just a character class for almost everything "bad" set RE {[][{};#\\\$ \r\t\u0080‐\uffff]} # We will substitute with a fragment of Tcl script in brackets set substitution {[format \\\\u%04x [scan "\\&" %c]]} # Now we apply the substitution to get a subst‐string that # will perform the computational parts of the conversion. Note # that newline is handled specially through string map since # backslash‐newline is a special sequence. set quoted [subst [string map {\n {\\u000a}} \ [regsub -all $RE $string $substitution]]] - login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [99a97110b2] (rid 110830) by dkf on 2010-09-10 20:02:46:
- icomment:
Fixed in HEAD and 8.5 branch (alas, just missed the train for 8.5.9...)
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [3555349688] (rid 106905) by dkf on 2010-09-10 20:03:02:
- icomment:
allow_comments - 1
- login: "dkf"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "dkf"
- icomment:
Ticket change [25c39e8aea] (rid 88224) by dkf on 2010-09-10 20:03:03:
- closedate changed to: "2010-09-10T13:03:03"
- closer changed to: "dkf"