Fix encodeURIComponent on Ruby 1.8.
Replace .ord with .unpack('U')[0]
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
# ~*~ encoding: utf-8 ~*~
|
||||
=begin
|
||||
Copyright 2006-2008 the V8 project authors. All rights reserved.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -39,7 +40,8 @@ end
|
||||
# define charCodeAt on String
|
||||
class String
|
||||
def charCodeAt(k)
|
||||
return self[k].ord
|
||||
# 'str'.ord is broken on 1.8
|
||||
return self[k].unpack('U')[0]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user