On Jan 9, 2014, at 10:35 PM, Allan Odgaard <mailinglist(a)textmate.org> wrote:
On 10 Jan 2014, at 9:21, Matt Neuburg wrote:
[…] The problem is that the "n"
modifier on the match requires that this string (str) be ASCII-8BIT encoding. But on the
Mac a file system path is UTF-8. Thus it is possible that this method will be sent a UTF-8
string and will choke on it.
The reason we coerce the 8-bit ASCII encoding onto the source string is to look at the
That way, your file name should be encoded as “h%C3%B6wdy.txt”.
I suggest that this utility may need to be
revised for use with Mavericks and Ruby 2.x.
If anyone know of a way to achieve the same with ruby 2 (that is backwards compatible)
I’ll gladly update the code.
It doesn't need to be backwards compatible, since your code can always check the Ruby
On my machine, simply calling URI.escape() does the job correctly. So you could either do
what URI.escape() does - Ruby is open source, so it easy to see how it works, by calling
each_byte or unpack("C*") and cycling through the "characters" - or
you could just call URI.escape() directly.
matt neuburg, phd = matt(a)tidbits.com, http://www.apeth.net/matt/
pantes anthropoi tou eidenai oregontai phusei
Programming iOS 7! http://shop.oreilly.com/product/0636920031017.do
iOS 7 Fundamentals! http://shop.oreilly.com/product/0636920032465.do
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com