From 9962aad7b0184e385b40c26c5a109bff7abbe43c Mon Sep 17 00:00:00 2001 From: naruse Date: Sat, 10 Aug 2013 20:44:10 +0000 Subject: * file.c (rb_str_normalize_ospath): HFS Plus (Mac OS Extended) uses a variant of Normal Form D in which U+2000 through U+2FFF, U+F900 through U+FAFF, and U+2F800 through U+2FAFF are not decomposed (this avoids problems with round trip conversions from old Mac text encodings). http://developer.apple.com/library/mac/qa/qa1173/_index.html Therefore fix r42457 to exclude the range. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/-test-/string/depend | 1 + ext/-test-/string/extconf.rb | 1 + ext/-test-/string/normalize.c | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 ext/-test-/string/normalize.c (limited to 'ext/-test-/string') diff --git a/ext/-test-/string/depend b/ext/-test-/string/depend index aad1fab427..86617ff289 100644 --- a/ext/-test-/string/depend +++ b/ext/-test-/string/depend @@ -2,3 +2,4 @@ $(OBJS): $(HDRS) $(ruby_headers) \ $(hdrdir)/ruby/encoding.h \ $(hdrdir)/ruby/oniguruma.h qsort.o: $(hdrdir)/ruby/util.h +normalize.o: $(top_srcdir)/internal.h diff --git a/ext/-test-/string/extconf.rb b/ext/-test-/string/extconf.rb index 42c10b994b..10d33cbab9 100644 --- a/ext/-test-/string/extconf.rb +++ b/ext/-test-/string/extconf.rb @@ -1,3 +1,4 @@ +$INCFLAGS << " -I$(topdir) -I$(top_srcdir)" $srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] inits = $srcs.map {|s| File.basename(s, ".*")} inits.delete("init") diff --git a/ext/-test-/string/normalize.c b/ext/-test-/string/normalize.c new file mode 100644 index 0000000000..22bb6d7887 --- /dev/null +++ b/ext/-test-/string/normalize.c @@ -0,0 +1,18 @@ +#include "ruby.h" +#include "internal.h" + +#ifdef __APPLE__ +static VALUE +normalize_ospath(VALUE str) +{ + return rb_str_normalize_ospath(RSTRING_PTR(str), RSTRING_LEN(str)); +} +#else +#define normalize_ospath rb_f_notimplement +#endif + +void +Init_normalize(VALUE klass) +{ + rb_define_method(klass, "normalize_ospath", normalize_ospath, 0); +} -- cgit v1.2.3