weshatheleopard / rubyXL

Ruby lib for reading/writing/modifying .xlsx and .xlsm files
MIT License
1.28k stars 255 forks source link

Fix invalid XML escaping of U+10000 to U+10FFFF character range #276

Closed felixbuenemann closed 7 years ago

felixbuenemann commented 7 years ago

This fixes a bug in the regular expression for escaping invalid XML characters.

Ruby requires the special syntax \u{hex} for matching unicode character with more than 4 bytes.

Because of this the regex range [^\u10000-\u10FFFF] was interpreted as [^\u1000]|[^0-\u10FF]|[^FF].

I found this bug because RUBYOPT=-W3 triggered a duplicate character range warning for the regex.