[TxMt] trouble with e_url in escape.rb (TextMate 2, Mavericks, Ruby 2.x)
matt at tidbits.com
Fri Jan 10 02:21:00 UTC 2014
Deep in the TextMate bundle is escape.rb, containing this utility:
# URL escape a string but preserve slashes (idea being we have a file system path that we want to use with file://)
'%' + $1.unpack('H2' * $1.size).join('%').upcase
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. For example:
[That's "howdy" with an umlaut over the o, in case it doesn't come across in your email.]
Now, it is legal to make a file:// URL that points to this file. But e_url is failing to create such a URL and we get a warning.
I suggest that this utility may need to be revised for use with Mavericks and Ruby 2.x.
matt neuburg, phd = matt at 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
More information about the textmate