Bug #1463
String#chars のマルチバイト処理
| Status: | Closed | Start date: | 05/12/2009 | |
|---|---|---|---|---|
| Priority: | Low | Due date: | ||
| Assignee: | % Done: | 100% |
||
| Category: | doc | |||
| Target version: | - | |||
| reporter: | 5.5 | ruby_version: | 1.8.7 |
Description
Ruby 1.8.7 の String#chars の説明で,$KCODE が適切に設定されていればマルチバイト文字も正しく処理されることを書くべきと思います。 また,サンプルには日本語と英数字が混じった文字列を使うと良いと思います。
Associated revisions
fix #1463 [ruby-reference-manual:1429]
History
Updated by 5.5 (5 5) over 2 years ago
パッチです。
Index: refm/api/src/_builtin/String
===================================================================
--- refm/api/src/_builtin/String (revision 3833)
+++ refm/api/src/_builtin/String (working copy)
@@ -2809,10 +2809,14 @@
文字列の各文字に対して繰り返します。
+#@if (version < "1.9.0")
+[[m:$KCODE]] が適切に設定されていれば、マルチバイト文字も正しく扱われます。
+#@end
+
たとえば、
- "hello".each_char {|c| print c, ' ' }
+ "hello世界".each_char {|c| print c, ' ' }
は次のように出力されます。
- h e l l o
+ h e l l o 世 界
#@since 1.9.1
Updated by 5.5 (5 5) about 2 years ago
- Assignee set to kouya (taifu kouya)
Updated by kouya (taifu kouya) almost 2 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r4111. 5, thank you for reporting this issue. Your contribution to Ruby is greatly appreciated. May Ruby be with you.