This content has been marked as final. Show 3 replies
Why should you have to know that? And what could you do if you did? All of the methods in the File API already return you file names as Strings.
And besides, "the charset of a String" is not a meaningful concept.
Thanks for your reply. On the client's end I need to convert the String into byte array, send these bytes over the network and recreate the string on the server's end. When I use fileName.getBytes(), it works if the file name is in English - meaning I can use the new String(byte) constructor to recreate the name. However, if the file name on the client is in a foreign language, I get question marks on the server's end.
I want to use the fileName.getBytes("charset") method instead to create the byte array so that it keeps the character sets intact.
So just choose a charset which can handle all characters. Like UTF-8 or one of the UTF-16 varieties.