Cannot convert string to ByteString because the character at index

TypeError: Cannot convert string to ByteString because the character at index 0 has value 1054 which is greater than 255.xhr.setRequestHeader(X-File-Name, file.name);

Replaced to..

xhr.setRequestHeader(X-File-Name, unescape(encodeURIComponent(file.name)));