ruby: converts encodings into UTF-8 on Ruby 1.9

This commit is contained in:
frsyuki
2010-08-31 06:30:16 +09:00
parent a1bd14e516
commit b5c78de2dd
6 changed files with 141 additions and 38 deletions

View File

@@ -17,9 +17,17 @@
*/
#include "pack.h"
#include "unpack.h"
#include "encoding.h"
static VALUE mMessagePack;
#ifdef MSGPACK_RUBY_ENCODING
int s_enc_utf8;
int s_enc_ascii8bit;
int s_enc_usascii;
VALUE s_enc_utf8_value;
#endif
/**
* Document-module: MessagePack
*
@@ -46,6 +54,13 @@ void Init_msgpack(void)
rb_define_const(mMessagePack, "VERSION", rb_str_new2(MESSAGEPACK_VERSION));
#ifdef MSGPACK_RUBY_ENCODING
s_enc_ascii8bit = rb_ascii8bit_encindex();
s_enc_utf8 = rb_utf8_encindex();
s_enc_usascii = rb_usascii_encindex();
s_enc_utf8_value = rb_enc_from_encoding(rb_utf8_encoding());
#endif
Init_msgpack_unpack(mMessagePack);
Init_msgpack_pack(mMessagePack);
}