Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] display_length issue with special-characters on non-UTF8 terminal
@ 2009-06-09 10:00 Tarko Tikan
  2009-06-12 19:18 ` William Morgan
  0 siblings, 1 reply; 6+ messages in thread
From: Tarko Tikan @ 2009-06-09 10:00 UTC (permalink / raw)


hey,

When String.display_length was introduced in recent update, it broke the length for non-UTF8 strings that contain the special characters. Wrong length results corrupted display (line ends chopped off).

Terminal is iso-8859-15 and it's detected by sup correctly.

I've tracked it down to /./u regexp. Here are some examples:

irb(main):001:0> "asd".scan(/./u)
=> ["a", "s", "d"]
irb(main):002:0> "asd????".scan(/./u)
=> ["a", "s", "d", "\365\374\344\366"]
irb(main):017:0> "asd???".scan(/./u)
=> ["a", "s", "d"]

irb(main):008:0* "asd".scan(/./)
=> ["a", "s", "d"]
irb(main):009:0> "asd????".scan(/./)
=> ["a", "s", "d", "\365", "\374", "\344", "\366"]

Expecting UTF8 gives unexpected results :) Also, old behaviour of String.length gives correct results with these test cases.

-- 
tarko


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-06-17 18:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-09 10:00 [sup-talk] display_length issue with special-characters on non-UTF8 terminal Tarko Tikan
2009-06-12 19:18 ` William Morgan
2009-06-13 11:13   ` Tarko Tikan
2009-06-15 14:10     ` William Morgan
2009-06-17 16:04     ` William Morgan
2009-06-17 18:34       ` Nicolas Pouillard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox