therubyracer 0.8.1 → 0.8.2.pre

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of therubyracer might be problematic. Click here for more details.

@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## Edge
4
+
5
+ * force UTf-8 encoding on strings returned from javascript in ruby 1.9
6
+
3
7
  ## 0.8.1 - 2011/03/07
4
8
 
5
9
  * upgrade to v8 3.1.8
@@ -81,7 +81,7 @@ module V8
81
81
  when V8::C::Function then peer(value) {V8::Function}
82
82
  when V8::C::Array then peer(value) {V8::Array}
83
83
  when V8::C::Object then peer(value) {V8::Object}
84
- when V8::C::String then value.Utf8Value()
84
+ when V8::C::String then value.Utf8Value.tap {|s| return s.respond_to?(:force_encoding) ? s.force_encoding("UTF-8") : s}
85
85
  when V8::C::Date then Time.at(value.NumberValue() / 1000)
86
86
  when V8::C::Value then nil if value.IsEmpty()
87
87
  else
@@ -94,7 +94,7 @@ module V8
94
94
  when V8::Object
95
95
  value.instance_eval {@native}
96
96
  when String
97
- C::String::New(value.to_s)
97
+ C::String::New(value)
98
98
  when Symbol
99
99
  C::String::NewSymbol(value.to_s)
100
100
  when Proc,Method,UnboundMethod
@@ -107,8 +107,8 @@ module V8
107
107
  end
108
108
  when ::Hash
109
109
  C::Object::New().tap do |o|
110
- value.each do |key, value|
111
- o.Set(v8(key), v8(value))
110
+ value.each do |key, val|
111
+ o.Set(v8(key), v8(val))
112
112
  end
113
113
  end
114
114
  when ::Time
@@ -1,3 +1,3 @@
1
1
  module V8
2
- VERSION = "0.8.1"
2
+ VERSION = "0.8.2.pre"
3
3
  end
@@ -1,4 +1,4 @@
1
-
1
+ # -*- encoding: utf-8 -*-
2
2
  require "#{File.dirname(__FILE__)}/../redjs_helper.rb"
3
3
 
4
4
  describe "Ruby Javascript API" do
@@ -52,6 +52,13 @@ describe "Ruby Javascript API" do
52
52
  @cxt.eval("'#{lorem}'").should == lorem
53
53
  end
54
54
 
55
+ it "correctly handles translating strings that have non-standard characters" do
56
+ @cxt['utf8'] = "Σὲ γνωρίζω ἀπὸ τὴν κόψη"
57
+ @cxt['utf8'].should == "Σὲ γνωρίζω ἀπὸ τὴν κόψη"
58
+ @cxt.eval('var nativeUtf8 = "Σὲ γνωρίζω ἀπὸ τὴν κόψη"')
59
+ @cxt['nativeUtf8'].should == "Σὲ γνωρίζω ἀπὸ τὴν κόψη"
60
+ end
61
+
55
62
  it "translates JavaScript dates properly into ruby Time objects" do
56
63
  now = Time.now
57
64
  @cxt.eval('new Date()').tap do |time|
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: therubyracer
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.8.1
4
+ prerelease: 6
5
+ version: 0.8.2.pre
6
6
  platform: ruby
7
7
  authors:
8
8
  - Charles Lowell
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-03-07 00:00:00 -06:00
14
+ date: 2011-03-09 00:00:00 -06:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
@@ -868,19 +868,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
868
868
  requirements:
869
869
  - - ">="
870
870
  - !ruby/object:Gem::Version
871
- hash: -3003649590438884226
871
+ hash: 2344231307376719393
872
872
  segments:
873
873
  - 0
874
874
  version: "0"
875
875
  required_rubygems_version: !ruby/object:Gem::Requirement
876
876
  none: false
877
877
  requirements:
878
- - - ">="
878
+ - - ">"
879
879
  - !ruby/object:Gem::Version
880
- hash: -3003649590438884226
881
- segments:
882
- - 0
883
- version: "0"
880
+ version: 1.3.1
884
881
  requirements: []
885
882
 
886
883
  rubyforge_project: therubyracer