Permalink
Browse files

made UTF-8 the default encoding instead of the Ruby default encoding

  • Loading branch information...
1 parent d5883c2 commit 7f6d49e9c5459a0b6100a3ff383ce8f8507a3f52 Peter Ohler committed Mar 26, 2012
Showing with 5 additions and 2 deletions.
  1. +2 −0 README.md
  2. +3 −2 ext/oj/oj.c
View
@@ -32,6 +32,8 @@ A fast JSON parser and Object marshaller as a Ruby gem.
- Oj::Doc now allows a document to be left open and then closed with the Oj::Doc.close() class.
+ - Changed the default encoding to UTF-8 instead of the Ruby default String encoding.
+
## <a name="description">Description</a>
Optimized JSON (Oj), as the name implies was written to provide speed
View
@@ -100,7 +100,8 @@ Cache oj_class_cache = 0;
Cache oj_attr_cache = 0;
struct _Options oj_default_options = {
- { '\0' }, // encoding
+ // { '\0' }, // encoding
+ "UTF-8", // encoding
0, // indent
No, // circular
Yes, // auto_define
@@ -418,7 +419,7 @@ dump(int argc, VALUE *argv, VALUE self) {
rb_raise(rb_eNoMemError, "Not enough memory.\n");
}
rstr = rb_str_new2(json);
-#ifdef ENCODING_INLINE_MAX
+#ifdef HAVE_RUBY_ENCODING_H
if ('\0' != *copts.encoding) {
rb_enc_associate(rstr, rb_enc_find(copts.encoding));
}

0 comments on commit 7f6d49e

Please sign in to comment.