• chasonr's avatar
    Implement sprintf("%c") for UTF-8. · 5e5ee841
    chasonr authored
    * sprintf("%c") is changed to accept a string for which String#size returns
      1, even if it is longer than one byte, and to convert a Fixnum via
      Fixnum#chr (possibly returning more than one byte).  Thus, if the UTF-8
      gem is in use, a character will be understood as a single UTF-8 character.
    
    * The change to sprintf depends on the implementation of Fixnum#chr added
      to mrbgems/mruby-string-utf8/src/string.c.
    
    This should work with any other gem that implements a multibyte encoding, as
    long as it implements String#size and Fixnum#chr as appropriate.
    5e5ee841
sprintf.c 32.6 KB