Commit 2dd06c6
Fix jruby encoding in new thread (#12919)
In jruby `runtime.evalScriptlet('Encoding::UTF_8')` can be broken under a newly created thread, which can cause protobuf encoding to fail. For example: https://github.com/ntkme/sass-embedded-host-ruby/actions/runs/5108602231/jobs/9182569583#step:5:544
It real issue seems to be in jruby itself. A bug report with minimal reproduction has been filed at jruby/jruby#7820
This PR fixes the problem by effectively replacing `runtime.evalScriptlet('Encoding::UTF_8')` with `runtime.getEncodingService().convertEncodingToRubyEncoding(org.jcodings.specific.UTF8Encoding.INSTANCE)`, which works on all threads.
Closes #12919
COPYBARA_INTEGRATE_REVIEW=#12919 from ntkme:fix-jruby-encoding 345680e
FUTURE_COPYBARA_INTEGRATE_REVIEW=#12919 from ntkme:fix-jruby-encoding 345680e
PiperOrigin-RevId: 5364985921 parent 4b3615c commit 2dd06c6
1 file changed
+10
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
| 41 | + | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
141 | 143 | | |
142 | 144 | | |
143 | 145 | | |
144 | | - | |
| 146 | + | |
145 | 147 | | |
146 | 148 | | |
147 | 149 | | |
148 | 150 | | |
149 | | - | |
| 151 | + | |
150 | 152 | | |
151 | 153 | | |
152 | 154 | | |
| |||
383 | 385 | | |
384 | 386 | | |
385 | 387 | | |
386 | | - | |
| 388 | + | |
387 | 389 | | |
388 | 390 | | |
389 | 391 | | |
390 | | - | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
391 | 397 | | |
392 | 398 | | |
393 | 399 | | |
| |||
0 commit comments