File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -198,10 +198,20 @@ describe('mo', function(){
198198 plural_forms : 'nplurals=4; plural=(n==1) ? 0 : (n%10==1 && n%100!=11) ? 3 : ((n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20)) ? 1 : 2);'
199199 } ) ;
200200
201- /* String gets mangled because it's the wrong encoding. */
202- locale_data . messages . should . have . property ( 'Manage Comments' , [
203- 'Управление комментариÑми'
204- ] ) ;
201+ locale_data . messages . should . have . property ( 'Manage Comments' ) ;
202+ locale_data . messages [ 'Manage Comments' ] . should . have . length ( 1 ) ;
203+
204+ var message = locale_data . messages [ 'Manage Comments' ] [ 0 ] ;
205+
206+ if ( typeof Buffer !== 'undefined' ) {
207+ /* There's a bug in Node.js's implementation of TextDecoder that causes it to
208+ incorrectly decode several Windows-1252 characters, see
209+ <https://github.com/nodejs/node/issues/56542>. */
210+ Buffer . from ( message , 'utf8' ) . toString ( 'base64' ) . should . equal ( 'w5DCo8OQwr/DkcKAw5DCsMOQwrLDkMK7w5DCtcOQwr3DkMK4w5DCtSDDkMK6w5DCvsOQwrzDkMK8w5DCtcOQwr3DkcKCw5DCsMORwoDDkMK4w5HCj8OQwrzDkMK4' ) ;
211+ } else {
212+ /* UTF-8 string read using the Windows-1252 encoding. */
213+ message . should . equal ( 'Управление комментариÑми' ) ;
214+ }
205215 } )
206216 it ( 'should throw for an invalid encoding option' , function ( ) {
207217 ( function ( ) {
You can’t perform that action at this time.
0 commit comments