2

I've just started to play with Firefox OS doing first app.

In app I'm using File API in order to get list of files in storage, but there is a problem here, I'm getting cyrillic paths in name property like this:

Moonbeam/Moonbeam/Albums/(2008) ÐÑикоÑновение [UL 077715]/07 Ðдин ÐенÑ.mp3

while correct should be

Moonbeam/Moonbeam/Albums/(2008) Прикосновение [UL 077715]/07 Один День.mp3

Not sure wether this is a bug inside Firefox OS Simulator or somewhere else. All files names in utf-8 encoding, I expected to get corresponding string.

Ubuntu 14.10 x64, Firefox 31.0, Firefox OS 1.4 Simulator

navigator.getDeviceStorage('music').enumerate().onsuccess = function () {
  var file = this.result;
  console.log(file.name);
  this.continue();
};
nazar-pc
  • 305
  • 4
  • 11

1 Answers1

0

HTML5 File API's default encoding is UTF-8.

FileReader.readAsText(Blob|File, opt_encoding) 
  • The result property will contain the file/blob's data as a text string. By default the string is decoded as 'UTF-8'. Use the optional encoding parameter can specify a different format.

In my Firefox OS simulator, File API sample app is working to display Korean filnename characters based on http://www.html5rocks.com/en/tutorials/file/dndfiles/ In detail, please refer to related question.

Community
  • 1
  • 1
Channy
  • 184
  • 4
  • I'm not talking about file content, because it is binary music file. I'm talkign about path I get in result of such code: navigator.getDeviceStorage('music').enumerate().onsuccess = function () { var file = this.result; console.log(file.name); this.continue(); } – nazar-pc Jul 09 '14 at 21:10