Skip to content

YAML::Store does not retrieve UTF8 values correctly in read-only mode #4770

@duritong

Description

@duritong

While investigating further problems on 9.1.7.0 related to #4767 I came accross a weird behavior of YAML::Store which does not print out correct unicode characters if the transaction is in readonly.

This is a small script that shows the problem

$ ruby --version
jruby 9.1.7.0 (2.3.1) 2017-01-11 68056ae OpenJDK 64-Bit Server VM 25.141-b16 on 1.8.0_141-b16 +jit [linux-x86_64]
$ cat pstore_test.rb 
require 'yaml/store'

puts 'PStore'
store = PStore.new('test.pstore')
store.transaction{ store['test'] = 'Tütü' }
print 'Correct: '
puts store.transaction{ store['test'] }
print 'Correct: '
puts store.transaction(true){ store['test'] }

puts 'YAML'
store = YAML::Store.new('test.yaml')
store.transaction{ store['test'] = 'Tütü' }
print 'Correct: '
puts store.transaction{ store['test'] }
print 'Incorrect: '
puts store.transaction(true){ store['test'] }
$ rm test.*
$ ruby pstore_test.rb 
PStore
Correct: Tütü
Correct: Tütü
YAML
Correct: Tütü
Incorrect: Tütü

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions