[#4522] Undefined Errno::EPROTO and the like raises NameError — "Florian Frank" <flori@...>
Hi,
[#4533] giving acces readline to rl_line_buffer — "Cs. Henk" <csaba-ml@...>
Hi!
[#4548] Ruby 1.8.2 array of hash entries functions incorrectly — noreply@...
Bugs item #1613, was opened at 2005-03-09 19:49
[#4561] rb_reg_quote weirdness — Nikolai Weibull <mailing-lists.ruby-core@...>
(Two weirdnesses in one day.)
Hi,
[#4567] Immutable Ropes — Nikolai Weibull <mailing-lists.ruby-core@...>
Note how I didn't write "Immutable Strings" in the subject.
[#4575] Allowing "?" in struct members — "Berger, Daniel" <Daniel.Berger@...>
Hi all,
[#4587] 0**0==1? — Bertram Scharpf <lists@...>
Hi,
[#4595] New block syntax — Daniel Amelang <daniel.amelang@...>
I'm really sorry if this isn't the place to talk about this. I've
Daniel Amelang wrote:
Hi --
On Monday 21 March 2005 16:17, David A. Black wrote:
Hi --
Hey David, I think that we've had some misunderstandings due to
Hi --
On Wednesday 30 March 2005 20:55, David A. Black wrote:
On Sunday 20 March 2005 21:31, Daniel Amelang wrote:
[#4601] Re: New block syntax — "Berger, Daniel" <Daniel.Berger@...>
> -----Original Message-----
[#4611] want_object? - possible? — "Berger, Daniel" <Daniel.Berger@...>
Hi all,
[#4619] Re: want_object? - possible? — Daniel Berger <djberg96@...>
--- nobu.nokada@softhome.net wrote:
Hi --
On 3/24/05, David A. Black <dblack@wobblini.net> wrote:
Hi --
On 4/14/05, David A. Black <dblack@wobblini.net> wrote:
On 14 Apr 2005, at 22:20, Mark Hubbart wrote:
On 4/15/05, Eric Hodel <drbrain@segment7.net> wrote:
[#4622] tempfile.rb — Tilman Sauerbeck <tilman@...>
Hi,
[#4648] about REXML::Encoding — speakillof <speakillof@...>
Hi.
On Thursday 31 March 2005 09:44, speakillof wrote:
Hi.
I've tested, applied, and committed your Encoding patch, Nobu.
Hi,
Re: Win32 Non-ASCII Filename Access
On Thu, 10 Mar 2005 07:18:37 +0900, Berger, Daniel
<Daniel.Berger@qwest.com> wrote:
>> -----Original Message-----
>> From: Austin Ziegler [mailto:halostatue@gmail.com ]
>> Sent: Wednesday, March 09, 2005 2:13 PM
>> To: ruby-core@ruby-lang.org
>> Subject: Re: Win32 Non-ASCII Filename Access
> Ok, I think I see your point now. I also noticed that the -U
> option hasn't been taken yet, btw. :)
;) Still,
>>>> I don't have the Ruby code in front of me, but a lot of things
>>>> probably wouldn't work quite the same if we used the UNICODE
>>>> macro. String#each_byte, anyone?
>>> It would be a case of caveat programmor in the case of String
>>> methods and the like. If you're using unicode, then something
>>> like String#each_byte would either return 2 bytes per char, or
>>> would yield two separate 8-bit chars.
>> But then we have two *different* versions of Ruby simply based on
>> how Ruby was compiled. If someone doesn't #define UNICODE,
>> they'll get one set of semantics; if they do, they'll get
>> another. BAD BAD BAD language.
> Even if you call _A or _W at runtime based on a global variable
> like $KCODE, how do you keep the String semantics identical for 1
> byte versus 2 byte characters for a method like String#each_byte?
Well, to a point, you don't. But I think you missed the point of
what I meant to implement:
1. In Win32, always call _W with the wchar_t version.
2. Immediately convert the wchar_t to char with WideToMultiByte
using CP_UTF8 ($KCODE == 'UTF-8') or CP_ACP ($KCODE == anything
else). In theory, I could support EUC-JP and SJIS, but I'm not
sure whether that's the case or not.
3. Pass the char version around. That means that #each_byte is
still not *quite* going to work, but it's going to work better
and more predictably than with wchar_t. Additionally, it *will*
work 100% with regular expressions.
4. When working with the file, convert it back from char to
wchar_t. Potential problem: $KCODE may have changed in the
intervening period. This will definitely be solved when the
m17n strings are ready, but can either be documented as a
limitation, or we can lobby Matz to add an encoding field to a
String now (defaulting to +nil+).
Callers to Win32 APIs would be encouraged to do the same; there
could be some helper functions or macros to accomplish the
conversion process both directions.
This works very well, by and large, at least with what we're doing
at work (and we can't afford to miss files). The only other thing
that would happen is that when working with files that are fully
anchored (e.g., C:/foo/bar/baz), the "unipath" marker (\\?\) would
be added to the front and all forward slashes would be converted to
backslashes (\\?\C:\foo\bar\baz).
This particular item hasn't really been discussed to death, at least
not its relationship with Win32. There is a definite need for this
in Windows.
Matz? What do you say? Should I make a patch? If so, should I make
it for 1.9 or 1.8 as well? Can I use $KCODE for this, or do I need
something else? How do we solve the problem mentioned in #4?
-austin
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca