From: tarko@lanparty.ee (Tarko Tikan)
Subject: [sup-talk] display_length issue with special-characters on non-UTF8 terminal
Date: Tue, 09 Jun 2009 13:00:13 +0300 [thread overview]
Message-ID: <1244536704-sup-7027@valgus> (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
next reply other threads:[~2009-06-09 10:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-09 10:00 Tarko Tikan [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1244536704-sup-7027@valgus \
--to=tarko@lanparty.ee \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox