WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
91212
ruby1.9 fails in PrettyPatch.rb with invalid byte sequence in UTF-8
https://bugs.webkit.org/show_bug.cgi?id=91212
Summary
ruby1.9 fails in PrettyPatch.rb with invalid byte sequence in UTF-8
Simon Pena
Reported
2012-07-13 03:58:17 PDT
After upgrading the setup in one of the GTK 64bits bots, we found that if ruby1.9 is used instead of ruby1.8, the following error happens when running test-webkitpy: /home/spenap/Projects/WebKit/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:108:in `gsub': invalid byte sequence in UTF-8 (ArgumentError) from /home/spenap/Projects/WebKit/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:108:in `normalize_line_ending' from /home/spenap/Projects/WebKit/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb:19:in `prettify' from /home/spenap/Projects/WebKit/Websites/bugs.webkit.org/PrettyPatch/prettify.rb:26:in `<main>' This is caused by the new encoding engine that Ruby 1.9 uses (see
http://blog.grayproductions.net/articles/ruby_19s_string
) I took a look at
http://smyck.net/2011/05/13/files-with-mixed-and-invalid-encodings-in-ruby/
to work around it, but iconv will be deprecated in the future, and String#encode is recommended instead. However, by looking at
http://blog.segment7.net/2010/12/17/from-iconv-iconv-to-string-encode
, the new alternative is not as straight-forward as using iconv. We're currently keeping ruby in version 1.8, which works as expected.
Attachments
Patch
(1.97 KB, patch)
2012-07-13 04:16 PDT
,
Simon Pena
no flags
Details
Formatted Diff
Diff
Patch
(3.89 KB, patch)
2012-10-02 00:20 PDT
,
Simon Pena
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Simon Pena
Comment 1
2012-07-13 04:03:55 PDT
CCing Caio, who added the normalize_line_ending method originally.
Simon Pena
Comment 2
2012-07-13 04:16:13 PDT
Created
attachment 152212
[details]
Patch
Simon Pena
Comment 3
2012-07-13 04:17:48 PDT
(In reply to
comment #2
)
> Created an attachment (id=152212) [details] > Patch
I've attached a patch using Iconv, although, as mentioned in
comment #0
, it should be better to use String#encode.
Hajime Morrita
Comment 4
2012-07-18 19:25:09 PDT
(In reply to
comment #3
)
> (In reply to
comment #2
) > > Created an attachment (id=152212) [details] [details] > > Patch > > I've attached a patch using Iconv, although, as mentioned in
comment #0
, it should be better to use String#encode.
Let's do what you think the best :-)
Simon Pena
Comment 5
2012-07-19 01:38:04 PDT
Comment on
attachment 152212
[details]
Patch OK, I'll try to come up with a proper fix later.
Simon Pena
Comment 6
2012-10-02 00:20:17 PDT
Created
attachment 166628
[details]
Patch
Simon Pena
Comment 7
2012-10-02 00:23:30 PDT
This new version of the patch uses the "proper" implementation when Ruby's version is >= 1.9 (using the string encode method) and keeps the current one for 1.8.
Hajime Morrita
Comment 8
2012-10-02 22:04:04 PDT
Comment on
attachment 166628
[details]
Patch Wow, I didn't know that encode() support :fallback option.
WebKit Review Bot
Comment 9
2012-10-03 04:53:45 PDT
Comment on
attachment 166628
[details]
Patch Clearing flags on attachment: 166628 Committed
r130276
: <
http://trac.webkit.org/changeset/130276
>
WebKit Review Bot
Comment 10
2012-10-03 04:53:48 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug