[#64517] Fw: Re: Ruby and Rails to become Apache Incubator Project — Tetsuya Kitahata <[email protected]>

What do you think? >> Ruby developers

13 messages 2014/08/23

[#64615] [ruby-trunk - Feature #10181] [Open] New method File.openat() — oss-ruby-lang@...

Issue #10181 has been reported by Technorama Ltd..

10 messages 2014/08/28
[#64616] Re: [ruby-trunk - Feature #10181] [Open] New method File.openat() — Eric Wong <normalperson@...> 2014/08/28

I like this feature.

[#64671] Fwd: [ruby-changes:35240] normal:r47322 (trunk): symbol.c (rb_sym2id): do not return garbage object — SASADA Koichi <ko1@...>

Why this fix solve your problem?

9 messages 2014/08/30
[#64672] Re: Fwd: [ruby-changes:35240] normal:r47322 (trunk): symbol.c (rb_sym2id): do not return garbage object — SASADA Koichi <ko1@...> 2014/08/30

(2014/08/30 8:50), SASADA Koichi wrote:

[ruby-core:64405] [ruby-trunk - Bug #10132] unpack() ignores default encoding when generating strings, always uses ASCII-8BIT

From: meta@...
Date: 2014-08-15 22:28:14 UTC
List: ruby-core #64405
Issue #10132 has been updated by mathew murphy.


Now that I read [the documentation on encodings](http://ruby-doc.org/core-2=
.0/Encoding.html) more carefully, I think the real problem is more fundamen=
tal: `__ENCODING__` doesn't determine the encoding of *all* created strings=
; it only affects strings created using string constants in the source code.

    String.new.encoding =3D> #<Encoding:ASCII-8BIT>
    "".encoding         =3D> #<Encoding:UTF-8>

So:

    > String.new =3D=3D ""
    =3D> true
    > String.new.encoding =3D=3D "".encoding
    =3D> false

So Ruby is actually behaving as documented, it's just that I find the behav=
ior surprising. Maybe I'm alone in that, though.

Any chance we could have a way to specify a default encoding for *all* crea=
ted strings?

----------------------------------------
Bug #10132: unpack() ignores default encoding when generating strings, alwa=
ys uses ASCII-8BIT
https://bugs.ruby-lang.org/issues/10132#change-48364

* Author: mathew murphy
* Status: Rejected
* Priority: Normal
* Assignee:=20
* Category:=20
* Target version:=20
* ruby -v: ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
New strings are generated in the default encoding:

    irb> __ENCODING__.name
    =3D> "UTF-8"
    irb> "=C3=BCnicode".encoding.name
    =3D> "UTF-8"

...but not if they're generated by unpack:

    irb> "=C3=BCnicode".split.pack('M*').unpack('M*').first
    =3D> "\xC3\xBCnicode"
    irb> "=C3=BCnicode".split.pack('M*').unpack('M*').first.encoding.name
    =3D> "ASCII-8BIT"

Workaround is to force the encoding on every string unpack generates:

    irb> "=C3=BCnicode".split.pack('M*').unpack('M*').first.force_encoding(=
__ENCODING__.name)
    =3D> "=C3=BCnicode"




--=20
https://bugs.ruby-lang.org/

In This Thread

Prev Next