AW: HTML entities (general Struts taglib problem with language entities)

2003-02-04 Thread Hirschmann, Bernhard

Jesus! So much work for that purpose? :-)

Have you tried to use UTF-8 for your JSPs? Then all that transforming to
HTML encoding is not necessary anymore. It works great at my project, and I
have to use more special characters than in German. (27 languages in fact)

See http://www.anassina.com/struts/i18n/i18n.html for a full how-to.

Regards,
Bernhard


-Ursprüngliche Nachricht-
Von: mech [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 4. Februar 2003 11:42
An: 'Struts Users Mailing List'
Betreff: RE: HTML entities (general Struts taglib problem with language
entities)


You can usually use the attribute (e.g. with bean:write):
filter=true if you want special characters converted into html
substitutions or filter=false if you like to format your view with
br tags.

Unfortunatally, i hate converting all my German language Umlaute into
auml; uuml; etc. in my database. 

If I say filter=true my German special letters won't get filtered and
I get stupid output if my Solaris server runs on English language
instead like my development server in German language.

If I say filter=true an use auml; etc. coming from my db fields, I
get  filtered to amp; which doesn't help much either...
In the html output I would get amp;uuml; instead of uuml; 

So I have to always filter=false and use auml; etc. for all German
characters in my db. :-( At least than I can also use html tags for
formating stored in the db.

So on question for the future development.
Could the tag filter be enhanced to filter not only brackets etc. but
also language characters? 

Otherwise you'll have a problems if you use filter=true and
filter=false aswell. Either you have to convert all your database
field's not to use any language specific characters. 
Or you can't use filter=true because your language specific html
entities get converted twice because one character in the escape
sequence (the  character) gets filtered again...

What would be needed would be an filter=true logic that doesn't filter
the  of escape sequences or to filter also language specific html
entities. The last thing would be the cleaner way.

Michael


 -Original Message-
 From: Mark Lowe [mailto:[EMAIL PROTECTED]] 
 Sent: Dienstag, 4. Februar 2003 11:16
 To: Struts List
 Subject: HTML entities
 
 
 Has anyone any information on preventing  and  being translated 
 into lt; and gt; when using the tag libs..
 
 I have a bunch of data in my sql... there are a few presentation tags 
 strored in the db (e.g. br, b etc)..
 
 I've parsed the results to replace any entities to  etc 
 but they're 
 being coverted in the jsp when iterating through the result...
 
 My results set contains
 
 br etc
 
 i read this into map which i then put into an array (array of maps)
 
 put the array in the request...
 
 It seems to me that
 
 the encoding is happening
 1. during the iteration
 2. when being set in the request
 3. when being added to the map
 
 I'm working my way through these possibilties now but if anyone knows 
 anything then please don't be shy..
 
 Any suggestions?
 
 Thanks mark
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




AW: HTML entities (general Struts taglib problem with language entities)

2003-02-04 Thread Hirschmann, Bernhard

Hey Michael,

that's right, if you define your JSP content as utf-8, it will be
interpreted as utf-8. So your text comming from the DB *must* be utf-8 as
well.
If you use a different character set in you DB, you could use a transformer,
which transforms this character set into utf-8. Then you don't have to worry
about correct displaying in the browser.

I would always use a resource bundle for your texts, no matter if you use
only German. The special characters in the resource bundle could use HTML
encoding, so you don't have to care about saving the properties files in
utf-8. (We do it this way)

You dont't have to save your JSPs in utf-8, since you don't use special
characters in the JSP code. You surely don't do that, right? Because the
first 128 characters of ASCII or ANSI are identical to utf-8, you don't have
to care about that.

Regards,
Bernhard


-Ursprüngliche Nachricht-
Von: mech [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 4. Februar 2003 12:22
An: 'Struts Users Mailing List'
Betreff: RE: HTML entities (general Struts taglib problem with language
entities)


I tried to set %@ page contentType=text/html; charset=UTF-8 % but
now even my German development server displays all german characters as
? only.

I guess I would have to use ALL text coming from resource bundles that
are converted to UTF8. And I would have to set my db also to utf8, i
guess.

But since I don't need i18n, just german language, I saw no sense to
start using resource bundles for only one language.
Or does it help to save all jsps in UTF8. Guess my Eclipse won't let me
do that, too.

Any other or more ideas? 
Thx.
Michael

 -Original Message-
 From: Hirschmann, Bernhard [mailto:[EMAIL PROTECTED]] 
 Sent: Dienstag, 4. Februar 2003 11:51
 To: 'Struts Users Mailing List'
 Subject: AW: HTML entities (general Struts taglib problem 
 with language entities)
 
 
 
 Jesus! So much work for that purpose? :-)
 
 Have you tried to use UTF-8 for your JSPs? Then all that 
 transforming to HTML encoding is not necessary anymore. It 
 works great at my project, and I have to use more special 
 characters than in German. (27 languages in fact)
 
 See http://www.anassina.com/struts/i18n/i18n.html for a full how-to.
 
 Regards,
 Bernhard
 
 
 -Ursprüngliche Nachricht-
 Von: mech [mailto:[EMAIL PROTECTED]]
 Gesendet: Dienstag, 4. Februar 2003 11:42
 An: 'Struts Users Mailing List'
 Betreff: RE: HTML entities (general Struts taglib problem 
 with language
 entities)
 
 
 You can usually use the attribute (e.g. with bean:write): 
 filter=true if you want special characters converted into 
 html substitutions or filter=false if you like to format 
 your view with br tags.
 
 Unfortunatally, i hate converting all my German language 
 Umlaute into auml; uuml; etc. in my database. 
 
 If I say filter=true my German special letters won't get 
 filtered and I get stupid output if my Solaris server runs on 
 English language instead like my development server in German 
 language.
 
 If I say filter=true an use auml; etc. coming from my db 
 fields, I get  filtered to amp; which doesn't help much 
 either... In the html output I would get amp;uuml; instead of uuml; 
 
 So I have to always filter=false and use auml; etc. for 
 all German characters in my db. :-( At least than I can also 
 use html tags for formating stored in the db.
 
 So on question for the future development.
 Could the tag filter be enhanced to filter not only brackets 
 etc. but also language characters? 
 
 Otherwise you'll have a problems if you use filter=true and 
 filter=false aswell. Either you have to convert all your 
 database field's not to use any language specific characters. 
 Or you can't use filter=true because your language specific 
 html entities get converted twice because one character in 
 the escape sequence (the  character) gets filtered again...
 
 What would be needed would be an filter=true logic that 
 doesn't filter the  of escape sequences or to filter also 
 language specific html entities. The last thing would be the 
 cleaner way.
 
 Michael
 
 
  -Original Message-
  From: Mark Lowe [mailto:[EMAIL PROTECTED]]
  Sent: Dienstag, 4. Februar 2003 11:16
  To: Struts List
  Subject: HTML entities
  
  
  Has anyone any information on preventing  and  being 
 translated
  into lt; and gt; when using the tag libs..
  
  I have a bunch of data in my sql... there are a few 
 presentation tags
  strored in the db (e.g. br, b etc)..
  
  I've parsed the results to replace any entities to  etc
  but they're 
  being coverted in the jsp when iterating through the result...
  
  My results set contains
  
  br etc
  
  i read this into map which i then put into an array (array of maps)
  
  put the array in the request...
  
  It seems to me that
  
  the encoding is happening
  1. during the iteration
  2. when being set in the request
  3. when being added to the map
  
  I'm working my way through these possibilties now

AW: HTML entities (general Struts taglib problem with language entities)

2003-02-04 Thread Hirschmann, Bernhard


Firstly:
bean:write filter=true doesn't transform ü into uuml;
it only transforms , ,  and  into its HTML encoding.
You can see that in the source code of 
org.apache.struts.util.ResponseUtils

Secondly:
If you're using charset=ISO-8859-1 your German special characters are only
displayed correctly, if your're using a German locale, as far as I remember.
Try to use a user with a different locale (english) on the same machine and
the display will be messed up.

 But when I have text field originally coming from my MySQL database on
 that Solaris machine that I want to display with bean:write I
 encounter problems and receive only ? in my html source.

Yes, if this text is encoded in ISO-8859-1 and your JSPs are told to use
UTF-8 or vice versa. So you should use only one character encoding for your
browser.


 Only bean:write filter=false in combination with data fields
 containing abcduuml;efgauml;test works fine.

Yes, because this text is fully ASCII compatible. (there are no special
characters)


 With bean:write filter=true the  get's converted to amp;

Yes, because [see firstly]


 I have no idea if this is more a mysql problem than a Tomcat/Struts
 issue since my above tests work fine as long as the data is not from db?
 Maybe it gets garbled in my database DAO classes already while querying
 the db... no idea...

As I said: Make sure your text from the DB is encoded in UTF-8, then it will
be displayed correctly in a JSP which uses UTF-8.


 I would always use a resource bundle for your texts, no 
 matter if you use only German. The special characters in the 
 resource bundle could use HTML encoding, so you don't have to 
 care about saving the properties files in utf-8. (We do it this way)
 I would do it, if i could rely on someone editing those resource bundles
 later and using taglibs. But unfortunately I have to use plain html
 saved as .jsp whereever possible for latter maintenance of html-only
 folks.

I think we're talking about two different things, are we?
When I say resource bundle then I mean the use of the
ApplicationResources.properties file. You can't use any taglib in it. But
you can write schouml;n instead of schön. That's what I have meant.


Is it more clear now? :-)

Regards,
Bernhard

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]