mirror of https://github.com/erickguan/ffi-icu.git
Get rid of iconv, collation now is reasonably fast
This commit is contained in:
parent
5ff5d67801
commit
52c8bbc838
|
@ -1,10 +1,10 @@
|
|||
require 'iconv'
|
||||
|
||||
module ICU
|
||||
|
||||
class UCharPointer < FFI::MemoryPointer
|
||||
def self.from_string(str)
|
||||
super Iconv.conv("wchar_t", "utf-8", str.encode("UTF-8"))
|
||||
# not sure how this will work with other encodings
|
||||
str = str.encode("UTF-8") if str.respond_to? :encode
|
||||
super str.unpack("U*").pack("L*")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue