Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JSON::Tiny] added \c rakudobug workaround
Also narrowed the range of printable characters (the ones we choose *not*
to escape) from 0..127 to 32..126.
  • Loading branch information
Carl Masak committed Jun 23, 2010
1 parent 00dd1d3 commit 5da3d1b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/JSON/Tiny.pm
Expand Up @@ -26,7 +26,9 @@ multi _tj(Str $d) {
'"'
~ (~$d).trans(['"', '\\', "\b", "\f", "\n", "\r", "\t"]
=> ['\"', '\\\\', '\b', '\f', '\n', '\r', '\t'])\
.subst(/<-[\c0..\c127]>/, { ord(~$_).fmt('\u%04x') }, :g)
# RAKUDO: This would be nicer to write as <-[\c32..\c126]>,
# but Rakudo doesn't do \c yet. [perl #73698]
.subst(/<-[\ ..~]>/, { ord(~$_).fmt('\u%04x') }, :g)
~ '"'
}
multi _tj(Array $d) {
Expand Down

0 comments on commit 5da3d1b

Please sign in to comment.