The login page in my Tapestry application has a property in which the password the user types in is stored, which is then compared against the value from the database. If the user enters a password with multi-byte characters, such as:
áéíóú
...an inspection of the return value of getPassword() (the abstract method for the corresponding property) gives:
áéÃóú
Clearly, that's not encoded properly. Yet Firebug reports that the page is served up in UTF-8, so presumably the form submission request would also be encoded in UTF-8. Inspecting the value as it comes from the database produces the correct string, so it wouldn't appear to be an OS or IDE encoding issue. I have not overridden Tapestry's default value for org.apache.tapestry.output-encoding in the .application file, and the Tapestry 4 documentation indicates that the default value for the property is UTF-8.
So why does Tapestry appear to botch the encoding when setting the property?
Relevant code follows:
Login.html
<html jwcid="@Shell" doctype='html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"' ...>
<body jwcid="@Body">
...
<form jwcid="@Form" listener="listener:attemptLogin" ...>
...
<input jwcid="password"/>
...
</form>
...
</body>
</html>
Login.page
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification
PUBLIC "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
<page-specification class="mycode.Login">
...
<property name="password" />
...
<component id="password" type="TextField">
<binding name="value" value="password"/>
<binding name="hidden" value="true"/>
...
</component>
...
</page-specification>
Login.java
...
public abstract class Login extends BasePage {
...
public abstract String getPassword();
...
public void attemptLogin() {
// At this point, inspecting getPassword() returns
// the incorrectly encoded String.
}
...
}
Updates
@Jan Soltis: Well, if I inspect the value that comes from the database, it displays the correct string, so it would seem that my editor, OS and database are all encoding the value correctly. I've also checked my .application file; it does not contain an org.apache.tapestry.output-encoding entry, and the Tapestry 4 documentation indicates that the default value for this property is UTF-8. I have updated the description above to reflect the answers to your questions.
@myself: Solution found.