Skip to content

Commit

Permalink
Replace the use of the locale-dependent iswprint with the locale-inde…
Browse files Browse the repository at this point in the history
…pendent u_isprint

Should fix https://www.macruby.org/trac/ticket/834
  • Loading branch information
vincentisambart committed May 5, 2011
1 parent 5912f76 commit 255d052
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion string.c
Expand Up @@ -27,6 +27,7 @@

#include <unicode/unum.h>
#include <unicode/utrans.h>
#include <unicode/uchar.h>

#define SET_CLASS(dst, src) \
do{ \
Expand Down Expand Up @@ -2945,7 +2946,8 @@ str_inspect(rb_str_t *str, bool dump)
inspect_append(result, '"', false);
__block UChar32 prev = 0;
str_each_uchar32(str, ^(UChar32 c, long start_index, long char_len, bool *stop) {
bool print = iswprint(c);
// 1.9 considers U+00AD (soft-hyphen) printable whereas ICU does not
bool print = u_isprint(c) || (c == 0xAD);
if (IS_BINARY_ENC(str->encoding) && c > 127) {
print = false;
}
Expand Down

0 comments on commit 255d052

Please sign in to comment.