compact_enc_det 0.5.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b279e2ff76dcfe77ac5fa5a5b1b4460558f4623e4cad9cb5443f2b72d1bcc15c
4
- data.tar.gz: 1bbbd0b13a4c2bd197d52b5a889f05d406f1b77a2a0f4bbe5f48adc977baef9e
3
+ metadata.gz: 61c2647510e32fcb25ebbd1865fca25d6eeee88179271a31d398abce27ded9f0
4
+ data.tar.gz: d48c052f4c8e9f741e51ed6eb29d6cbd63b691067923cbcd4b9662633311daa3
5
5
  SHA512:
6
- metadata.gz: f8218d5eb64fbe44933a274d793972088fe7a6239862d8f733067d31968d724c720ea265dac9913b902012958a5987ef4f754b452384044025c8ebc25333bce9
7
- data.tar.gz: fa4956674eb82b53e206a00f99568108e780512040e4e035420681e1d46610038645a32d8fba5143429e5e46f8f7fd2891e65b8ef7768647333b23cf21363608
6
+ metadata.gz: 3d1efb9b630020650e8fdc242f50295c3c71014a6a4e11f5a9747c4cfcd754e8921bfc30ce1e5fa60832b1a227173953082ab05263af2c121a22848ef545671d
7
+ data.tar.gz: a5fe81c1c59b87cdfaffa7c2cbb827dca231aff525abe286d2d671693898e41d10f3a915df2aee365224b8478ad3d5658cda3b1ac901f0d17ed6d09bc428868a
data/README.md CHANGED
@@ -31,7 +31,7 @@ Now you can detect the encoding via the `CompactEncDet.detect_encoding`,
31
31
  which is a thin wrapper around `CompactEncDet::DetectEncoding` and `MimeEncodingName` functions from the C++ library.
32
32
 
33
33
  > ```ruby
34
- > file = File.read("unknown-encoding.txt")
34
+ > file = File.read("unknown-encoding.txt", mode: "rb")
35
35
  > result = CompactEncDet.detect_encoding(file)
36
36
  > result.encoding
37
37
  > # => #<Encoding:Windows-1250>
@@ -56,9 +56,12 @@ static VALUE detect_encoding(int argc, VALUE *argv, VALUE self)
56
56
  &corpus_type,
57
57
  &ignore_7bit_mail_encodings);
58
58
 
59
+ // Ensure the text argument is a Ruby string
60
+ Check_Type(text, T_STRING);
61
+
59
62
  // Convert the Ruby arguments to C++ types
60
- const char* c_text = StringValueCStr(text);
61
- const int c_text_length = NIL_P(text_length) ? strlen(c_text) : NUM2INT(text_length);
63
+ const char* c_text = RSTRING_PTR(text);
64
+ const int c_text_length = NIL_P(text_length) ? RSTRING_LEN(text) : NUM2INT(text_length);
62
65
 
63
66
  // Declare the output variables
64
67
  int bytes_consumed;
@@ -1,3 +1,3 @@
1
1
  module CompactEncDet
2
- VERSION = "0.5.0"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compact_enc_det
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cloudaper