Skip to content

Commit

Permalink
FIX: Incorrectly molded NBSP char
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Aug 31, 2023
1 parent c015aa3 commit ad98633
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/s-mold.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ STOID Sniff_String(REBSER *ser, REBCNT idx, REB_STRF *sf)
static REBUNI *Emit_Uni_Char(REBUNI *up, REBUNI chr, REBOOL parened)
{
if (chr >= 0x7f || chr == 0x1e) { // non ASCII or ^ must be (00) escaped
if (parened || chr <= 0xA0 || chr == 0x1e) { // do not AND with above
if (parened || chr < 0xA0 || chr == 0x1e) { // do not AND with above
*up++ = '^';
*up++ = '(';
up = Form_Uni_Hex(up, chr);
Expand Down
2 changes: 1 addition & 1 deletion src/mezz/codec-json.reb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ non-zero-digit: #[bitset! #{0000000000007FC0}] ;= charset "123456789"
chars: #[bitset! [not bits #{FFFFFFFF2000000000000008}]] ;=charset [not {\"} #"^@"-#"^_"]

; chars allowed in Rebol word! values - note that we don't allow < and > at all even though they are somewhat valid in word!
not-word-char: charset {/\^^,[](){}"#%$@:;^/^(00A0) ^-^M<>}
not-word-char: #[bitset! #{00640000BCC9003A8000001E000000140000000080}] ;=charset {/\^^,[](){}"#%$@:;^/^(00A0) ^-^M<>}
word-1st: complement append union not-word-char digit #"'"
word-char: complement not-word-char

Expand Down
4 changes: 3 additions & 1 deletion src/tests/units/mold-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,11 @@ Rebol [
===start-group=== "mold char!"
--test-- "mold invisible chars"
;@@ https://github.com/Oldes/Rebol-issues/issues/2562
for i 127 160 1 [
for i 127 159 1 [
--assert all [8 = length? v: mold to char! i v/4 = #"("]
]
;@@ https://github.com/Oldes/Rebol-issues/issues/2564
--assert #{2322C2A022} == to binary! mold to char! 160
===end-group===


Expand Down

0 comments on commit ad98633

Please sign in to comment.