2.0.0-p247 :001 > require "leveldb"
=> true
2.0.0-p247 :002 > db = LevelDB::DB.new("test.ldb")
=> #<LevelDB::DB:0x3fcd84c4be04>
2.0.0-p247 :003 > db["foo Malmö bar"] = "biz Malmö baz"
=> "biz Malmö baz"
2.0.0-p247 :004 > db["foo Malmö bar"]
=> "biz Malm\xC3\xB6 ba" # NOTE the missing "r" at the end, due to size != bytesize
2.0.0-p247 :005 > db["foo Malmö bar"] == "biz Malmö baz" # TEST
=> false
The issue here I think stems from the fact that String#size is being used instead of String#bytesize in the code. By updating the code to use String#bytesize the issue of truncation seemed to go away looking at the string. However, the test (the last line of my irb session) still doesn't work. So I am certainly missing something wrt encoding but got stuck making further progress. Thanks!
The issue here I think stems from the fact that String#size is being used instead of String#bytesize in the code. By updating the code to use String#bytesize the issue of truncation seemed to go away looking at the string. However, the test (the last line of my irb session) still doesn't work. So I am certainly missing something wrt encoding but got stuck making further progress. Thanks!