Permalink
Browse files

use empty? instead of == "" in jpcntxt

  • Loading branch information...
1 parent f4148c0 commit 264ee1879061eada9f2bfa9c968ca620ea211d10 @jmhodges committed Dec 2, 2012
Showing with 3 additions and 2 deletions.
  1. +2 −1 lib/rchardet/codingstatemachine.rb
  2. +1 −1 lib/rchardet/jpcntx.rb
@@ -44,7 +44,8 @@ def reset
def next_state(c)
# for each byte we get its class
# if it is first byte, we also get byte length
- byteCls = @model['classTable'][c[0]]
+ b = c[0]
+ byteCls = @model['classTable'][b]
if @currentState == EStart
@currentBytePos = 0
@currentCharLen = @model['charLenTable'][byteCls]
View
@@ -183,7 +183,7 @@ def get_order(aStr)
class SJISContextAnalysis < JapaneseContextAnalysis
def get_order(aStr)
- return -1, 1 if aStr.nil? || aStr == ""
+ return -1, 1 if aStr.nil? || aStr.empty?
# find out current char's byte length
first = aStr[0, 1]
if ((first >= "\x81") and (first <= "\x9F")) or ((first >= "\xE0") and (first <= "\xFC"))

0 comments on commit 264ee18

Please sign in to comment.