From: "V. Karthik Kumar" <guilt () bafsoft ! com>
Date: 2004-08-31 19:32:43
Message-ID: 1093980042.5241.7.camel () ATLAS
use:
response.setCharacterEncoding("Whatever"); <-- internally, this is what
the tags translate to...
Before u carry on with out.print() statements...
And one more thing.. there is an option available to add encoding
messages by default; a filter is available by default....
filters.setCharacterEncodingFilter
look in the servlets-examples\WEB-INF\web.xml
:)
On Wed, 2004-09-01 at 00:37, John Villar wrote:
then you should use the <%@ page %> directive..... search the web.... it
has a way to specify encoding
Sebastian Ryszard Kruk escribió:
> Dnia 08/30/2004 07:01 PM, Użytkownik John Villar napisał:
>
>> i don't know much about the ".tag" format.... however, if it is an
>> XML based one, you must define the charset of your xml in the <?xml?>
>> tag
>>
>> Sebastian Ryszard Kruk escribió:
>>
>>> Hi,
>>>
>>> I have a strange problem - I use tomcat 5.0.14.
>>>
>>> When I try to put some strings with polish letters like "ÅšciÄ…ga" in
>>> tag file - it results that during the translation to *.java file -
>>> this text is being replaced by ÅciÄga - just as it would treat the
>>> *.tag file as encoded in Latin1 rather than in UTF-8. Polish letters
>>> in *.jsp files are ok, though.
>>>
>>> Any ideas ??
>>>
>>> Thanks,
>>>
>>> skruk
>>
>
>
> it is not - it is rather a part of JSP page ;-(
Using response.setCharacterEncoding("Whatever"); would not solve the
problem as characters are embedded into the tag file itself, the
out.print() statements contains the characters, rather it is a
compile time issue as demonstrated by this exception:
An error occurred at line: 3 in the jsp file: /WEB-INF/tags/restricted.tag
Generated servlet error:
C:\jakarta-tomcat-5.0.28\work\Catalina\localhost\_\org\apache\jsp\tag\web\restricted_tag.java:15:
unclosed character literal
return c == 'â?§' || c == 'â?(c)' || c == '&';
^
Using native2ascii on the tag file solves the problem by converting
the return statement to:
return c == '\u2227' || c == '\u2229' || c == '&';
However I do not want to use '\u2227', I want to use '∧' in my tag file.
Using <?xml version="1.0" encoding="UTF-8"?> does not work, and the
<%@ page %> directive is not allowed in tag files, instead one should
use the corresponding tag file directive: <%@ tag
pageEncoding="UTF-8" %> which does work.
The tag directive is useless in the case when <%@ tag
pageEncoding="UTF-32" %> is needed, because the tag directive itself
is encoded in a character encoding which does not directly contain any
ascii character byte sequences as a subset of the encoding.
Additional support similar to:
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>javaEncoding</param-name>
<param-value>UTF-16LE</param-value>
</init-param>
</servlet>
for tag files would be appreciated, or better yet just take the
character set encoding specified for jsp files and apply that to the
org.apache.jasper.compiler.Compiler tag file compiler class as well.
For now I will have to specify <%@ tag pageEncoding="UTF-8" %> on top
of every tag file.