johannhof / gulp-phraseapp

Importing Phraseapp translations as a Gulp task
4 stars 5 forks source link

Invalid characters #9

Open chavlji opened 4 years ago

chavlji commented 4 years ago

I use this code, to download translations:

gulp.task('phraseapp:download-webapp', function() {
  return phraseapp.download({
    accessToken: '000',
    projectID: '000',
    file_format: 'nested_json',
    base: 'en'
  }).pipe(gulp.dest('./src/_data/phraseapp/webapp/'));
});

On random I get invalid characters in my jsons:

Screenshot 2020-01-09 at 13 47 01

What could be the cause? It happens in a lot of languages: de, es, it, sl, zh, ru,...

chavlji commented 4 years ago

As can be seen here, it seems random. I haven't touched those translations lately. After running script a few times, some new translations gets corrupted, while some of the old errors are gone:

Screenshot 2020-01-09 at 13 53 31
chavlji commented 4 years ago

If anybody else runs into this issue:

There's a bug with turning buffer chunks into UTF8 string too early. Buffers should be concat together as raw byte buffers and converted to string at the end:

Screenshot 2020-01-10 at 13 48 41