Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed the compatible problem with Rails

The $KCODE settings in Rails caused the String#split works differently
from what was expected. Replaced it to String#each_byte and solved the
problem.
  • Loading branch information...
commit d0f14f3ea54979b0d7eb079b0f1803f3987deb74 1 parent a4bfd27
@windix windix authored
View
3  lib/rchardet/escprober.rb
@@ -63,7 +63,8 @@ def get_confidence
end
def feed(aBuf)
- for c in aBuf.split('')
+ aBuf.each_byte do |b|
+ c = b.chr
for codingSM in @_mCodingSM
next unless codingSM
next unless codingSM.active
View
3  lib/rchardet/latin1prober.rb
@@ -109,7 +109,8 @@ def get_charset_name
def feed(aBuf)
aBuf = filter_with_english_letters(aBuf)
- for c in aBuf.split('')
+ aBuf.each_byte do |b|
+ c = b.chr
charClass = Latin1_CharToClass[c[0]]
freq = Latin1ClassModel[(@_mLastCharClass * CLASS_NUM) + charClass]
if freq == 0
View
3  lib/rchardet/sbcharsetprober.rb
@@ -71,7 +71,8 @@ def feed(aBuf)
if not aLen
return get_state()
end
- for c in aBuf.split('')
+ aBuf.each_byte do |b|
+ c = b.chr
order = @_mModel['charToOrderMap'][c[0]]
if order < SYMBOL_CAT_ORDER
@_mTotalChar += 1
View
3  lib/rchardet/utf8prober.rb
@@ -47,7 +47,8 @@ def get_charset_name
end
def feed(aBuf)
- for c in aBuf.split('')
+ aBuf.each_byte do |b|
+ c = b.chr
codingState = @_mCodingSM.next_state(c)
if codingState == EError
@_mState = ENotMe
Please sign in to comment.
Something went wrong with that request. Please try again.