Hello guys,
Here's a problem that's giving me a hard time. I am working on a web server in Java and right now I want to enable the user to create a photo album. The user can type the album name in an <input> field in an HTML form. The problem is that I receive the client request to create a new album with the album name being encoded in some way, which I can't figure out. Here's what I have so far:
1. A simple .html file that contains the form (it's quite large, so I won't post it here) and I am using this as the encoding:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
2. A form that contains the input field for the album name. Here's the code for it:
<form method="post" name="createAlbumForm" action="../createnewalbum" enctype="multipart/form-data">
<font color="gray">New album name </font>
<input type="text" id="albumNameField" name="albumNameField" style="border-color:#7799ff; margin-left:10px; margin-top:15px; width:200px"><br \>
<input type="button" value="Create album" style="height:25px; background-color:#7799ff; color:white; font-weight:bold; margin-top:10px; margin-bottom:10px; margin-right:20px" onClick="createNewAlbum()">
<input type="button" value="Close" style="height:25px; background-color:#7799ff; color:white; font-weight:bold;" onClick="closeNewAlbumDialog()">
</form>
3. The createNewAlbum() function:
function createNewAlbum() {
var string = document.getElementById( 'albumNameField' ).value;
if ( string != "" ) {
document.forms[ 'createAlbumForm' ].submit();
}
}
And here's the request from the client that my server prints out:
POST /createnewalbum HTTP/1.1
Host: www.gravyty.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: keep-alive
Referer: http://www.gravyty.com/UserHome.html
Content-Type: multipart/form-data; boundary=---------------------------14945890932209
Content-Length: 179
-------------------14945890932209
Content-Disposition: form-data; name="albumNameField"
Тест
-----------------------------14945890932209--
So, my question is how should I read this Тест ? I tried to use URLDecoder with both "UTF-8" and "ISO-8859-1" with no luck? Any ideas? Thanks in advance :)