tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Doppelfeld <>
Subject Character encoding within form based autentication
Date Fri, 29 Oct 2004 18:24:38 GMT
Hi out there,

I'm still facing problems with the character encoding in TV 5.0.28.
I'm not sure if it's wise to open another thread, but my further 
investigation have brought me to a new point, so I think it will be ok 
and I'll add the a link to this thread in my previous thread...
Debugging TC I traced my problem down to this method:

    // Basically return everything after ";charset="
    // If no charset specified, use the HTTP default (ASCII) character set.
    public static String getCharsetFromContentType(String type) {
        if (type == null) {
            return null;
        int semi = type.indexOf(";");
        if (semi == -1) {
            return null;
        int charsetLocation = type.indexOf("charset=", semi);
        if (charsetLocation == -1) {
            return null;
    String afterCharset = type.substring(charsetLocation + 8);
        // The charset value in a Content-Type header is allowed to be 
        // and charset values can't contain quotes.  Just convert any quote
        // chars into spaces and let trim clean things up.
        afterCharset = afterCharset.replace('"', ' ');
        String encoding = afterCharset.trim();
        return encoding;

But how to specify this charset within the html code??? When i try

    <form name="login" action="j_security_check" method="post" 
        <input name="j_username" type="text" label="Email" 
        <input name="j_password" type="password" label="Email" 
        <button name="login" icon="reset.gif" label="Anmelden" 
href="javascript: document.login.submit();" i18n:attr="label"/>

I'll get the a content type of "application/x-www-form-urlencoded"
When I append content-type="plain/text;charset=UTF-8" to form element, 
my conten type won't show up.
I tried several settings of |useBodyEncodingForURI and ||URIEncoding but 
won't get it running

Help is highly appreciated.

Thanks in advance


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message