Bugs item #618821, was opened at 2002-10-04 23:54
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=104754&aid=618821&group_id=4754
Category: Tapestry
Group: bug
Status: Open
Resolution: None
Priority: 5
Submitted By: Bruno Unna (bruno)
Assigned to: Howard Lewis Ship (hship)
Summary: Int'l chars in a text field get lost
Initial Comment:
When a final user uses a text field to capture
characters belonging to the spanish language (for
example 'á', 'é' or 'ñ'), what the corresponding
property setter receives as an argument is not what the
user typed. I suspect this happens with any character
outside the basic ASCII set.
It looks like those characters receive a treatment
which translates them into their 2-byte unicode
equivalence... within a pure ASCII string.
Allow me to illustrate the phenomenon using a
simplified example:
* The application draws a form with only one field
(last name) and a submission button.
* The final user types "ábaco" (the first letter is an
'a' with an acute accent on it).
* The logger writes to the console:
21:38:37,934 INFO [TelemetrixEngine] entering
setLastName("ábaco")
Any further use of that property, including inserting
it in the page, using -let's say- an Insert component,
renders the same result: "ábaco".
Some information that may be useful, as reported by the
Inspector component, under "Headers":
Accept-Charset ISO-8859-1, utf-8;q=0.66, *;q=0.66
Accept-Encoding gzip, deflate, compress;q=0.9
Accept-Language en, es;q=0.50
Connection keep-alive
User-Agent Mozilla/5.0 Galeon/1.2.6 (X11; Linux i686;
U;) Gecko/20020916
Note that I have obtained the very same result using
Internet Explorer 5 on a windows machine, instead of
Galeon in my Linux one.
The template of the form
(com/iac/telemetrix/pages/admin/Users.html) is:
--- 8< --- 8< --- 8< ---
...
<form jwcid="formAddUser">
Last name: <input jwcid="textFieldLastName"/>
<input type="submit" value="ok">
</form>
...
--- 8< --- 8< --- 8< ---
The specification of the page
(com/iac/telemetrix/pages/admin/Users.page) goes like this:
--- 8< --- 8< --- 8< ---
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification
PUBLIC "-//Howard Lewis Ship//Tapestry
Specification 1.3//EN"
"http://tapestry.sf.net/dtd/Tapestry_1_3.dtd">
<page-specification
class="com.iac.telemetrix.pages.admin.Users">
<component id="formAddUser" type="Form">
<binding name="listener"
expression='listeners.newUserFormSubmit'/>
</component>
<component id="textFieldLastName" type="TextField">
<binding name="value" expression='lastName'/>
</component>
</page-specification>
--- 8< --- 8< --- 8< ---
And the associated java file
(com/iac/telemetrix/pages/admin/Users.java) includes
the following:
--- 8< --- 8< --- 8< ---
package com.iac.telemetrix.pages.admin;
...
public class Users extends BasePage
{
private String _lastName = null;
/**
* Returns the lastName.
* @return String The lastName of the User
**/
public String getLastName()
{
return _lastName;
}
/**
* Sets the lastName.
* @param lastName The lastName to set
**/
public void setLastName(String lastName)
{
((TelemetrixEngine) getEngine()).LOG.info("entering
setLastName(\"+lastName+"\)");
this._lastName = lastName;
}
}
--- 8< --- 8< --- 8< ---
I'm using JBoss 3.0.3 as my application server, running
in a GNU/Linux box, with kernel 2.4.18-4, JDK 1.4.1-rc,
and Tapestry 2.2-beta-3.
I strongly believe that this behavior has a lot to do
with what Tom Davies describes in
http://sourceforge.net/mailarchive/message.php?msg_id=1851192
, but I'm not fluent with Tapestry source code as of
now, and therefore I'm filing this report.
----------------------------------------------------------------------
Comment By: Robson Miranda (rpdmiranda)
Date: 2002-12-11 23:48
Message:
Logged In: YES
user_id=531124
There is some way to do this without using -
Dfile.encoding=UTF8? In my production environment there
already have a Tomcat running with ISO-8859-1, and some
applications there that cannot be converted to UTF8.
Thanks
----------------------------------------------------------------------
Comment By: Bruno Unna (bruno)
Date: 2002-10-08 14:25
Message:
Logged In: YES
user_id=4039
Well, it works! Tom, you have saved my day.
Anyway, I still wonder why this is necessary: it looks like
a workaround to me. Shouldn't the Unicode approach work from
the very beginning? What is the piece I'm missing here?
Thanks for your attention.
----------------------------------------------------------------------
Comment By: Tom Davies (tomdavies)
Date: 2002-10-06 04:42
Message:
Logged In: YES
user_id=289547
The approach I use now is to use UTF-8 as the encoding for
the page, see
http://tapestry.sourceforge.net/wiki/index.php/EnablingUnicode
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=104754&aid=618821&group_id=4754
-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.