You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Bob Herrmann <bo...@jadn.com> on 2002/08/06 18:17:03 UTC

[5] I18N, CharsetMapper, DeploymentDescriptor

In the Servlet 2.4 spec section 5.4 on i18n, the deployment descriptor
gets new stuff for mapping locale to character encoding. The spec says,

[Section 5.4]

"[...] The setLocale method also sets charset component in Content-Type
with an encoding information which can be obtained from the
locale-encoding-mapping element in the deployment descriptor, if
present. For example, to map a locale to the specific encoding, the
syntax of locale-encoding-mapping would be:

   <locale-encoding-mapping-list>
        <locale-encoding-mapping>
             <locale>ja</locale>
             <encoding>ISO-2022-JP</encoding>
        </locale-encoding-mapping>
    </locale-encoding-mapping-list>
" 

To implement this, I started like this, 

1. I added some lines to the digester to push the local and encoding
info into the Context 

2. I changed the context to push the mapping into the CharsetMapper
class 

3. Changed the CharsetMapper class so it can accept new mappings 

4. changed setLocale() so it consults CharsetMapper and sets the mapped
encoding


The problem with this approach is that CharsetMapper has a lot of
default values, and the spec says setting the encoding should by
consulting the Deployment Descriptor.  So I should probably create a
seperate map for the "DeploymentDescriptorLocaleEncodingMapping" in the
Context, right? ideas?

Cheers,
-bob




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>