Project

General

Profile

Backport #4028

Updated by jeremyevans0 (Jeremy Evans) almost 5 years ago

=begin 
  
  Substring selection does not work with some utf8 encoded strings. Below is an example. The first substring is well extracted but the second not (extrange characters appear at the end of the substring). 
 
  It seems it occurs when the string includes letters with umlauts, accents, etc. 
 
  $ irb 
 
  ruby-1.9.1-p378 > word = "Ábaco" 
   => "Ábaco"  
  ruby-1.9.1-p378 > substr = word[word.length-1,word.length] 
   => "o" 
  ruby-1.9.1-p378 > word = "Coordinador de ONG's do País Valenciano" 
   => "Coordinador de ONG's do País Valenciano"  
  ruby-1.9.1-p378 > substr = word[word.length-1,word.length] 
   => "o\x00\x00\x01\x00\x01\x00\x00\x00" 
 
 =end 
 

Back