Re: [Wicket-user] Escaping German Umlauts

2007-06-03 Thread Kent Tong
Johannes Schneider johannes at familieschneider.info writes:

 I have found this method and discovered that it is not used within 
 component.
 But I can't propose anything because I am a newbie to Wicket ;).

Try:

public class EscapingTextField extends TextField {
public EscapingTextField(String id, IModel object) {
super(id, object);
}
protected String getModelValue() {
return Strings.escapeMarkup(
getModelObject().toString(), true, true)
.toString();
}
}




-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Escaping German Umlauts

2007-06-03 Thread Eelco Hillenius
On 5/31/07, Jean-Baptiste Quenot [EMAIL PROTECTED] wrote:
 * Johannes Schneider:

  can anyone  tell me how I  can escape German umlauts  when using
  TextFields  or  Labels?  Component.setEscapeModelStrings(  true)
  does  not replace  them. And I  really  don't want  to create  a
  custom IModel for every component I add

 Have a look at Strings#escapeMarkup(String, boolean, boolean)

 The  last argument  is called  convertToHtmlUnicodeEscapes and  by
 reading the Javadoc I think it does what you want.

I just changed getModelObjectAsString:

if (getFlag(FLAG_ESCAPE_MODEL_STRINGS))
{
// Escape it
return Strings.escapeMarkup(modelString, false, 
true).toString();
}

This seems to better anyway, and I couldn't find any nasty side
effects, nor did any of the unit tests fail. Johannes, can you confirm
this fixes your problem?

Thanks,

Eelco

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Escaping German Umlauts

2007-06-03 Thread Johannes Schneider

Hi,

I think it works as expected. Thanks for the fast change.


Johannes Schneider


Eelco Hillenius wrote:

On 5/31/07, Jean-Baptiste Quenot [EMAIL PROTECTED] wrote:

* Johannes Schneider:


can anyone  tell me how I  can escape German umlauts  when using
TextFields  or  Labels?  Component.setEscapeModelStrings(  true)
does  not replace  them. And I  really  don't want  to create  a
custom IModel for every component I add

Have a look at Strings#escapeMarkup(String, boolean, boolean)

The  last argument  is called  convertToHtmlUnicodeEscapes and  by
reading the Javadoc I think it does what you want.


I just changed getModelObjectAsString:

if (getFlag(FLAG_ESCAPE_MODEL_STRINGS))
{
// Escape it
return Strings.escapeMarkup(modelString, false, 
true).toString();
}

This seems to better anyway, and I couldn't find any nasty side
effects, nor did any of the unit tests fail. Johannes, can you confirm
this fixes your problem?

Thanks,

Eelco

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


--
Johannes Schneider
Im Lindenwasen 15
72810 Gomaringen

Fon +49 7072 9229972
Fax +49 7072 50
Mobil +49 178 1364488

[EMAIL PROTECTED]
http://www.johannes-schneider.info


smime.p7s
Description: S/MIME Cryptographic Signature
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Escaping German Umlauts

2007-06-01 Thread Johannes Schneider
Hi,

Jean-Baptiste Quenot wrote:
 Have a look at Strings#escapeMarkup(String, boolean, boolean)
 
 The  last argument  is called  convertToHtmlUnicodeEscapes and  by
 reading the Javadoc I think it does what you want.
 
 But now,  that doesn't mean you  can use it from  the Component or
 FormComponent class.   We need to  find an acceptable  solution to
 expose this feature to the Component level.  What do you propose?

I have found this method and discovered that it is not used within 
component.
But I can't propose anything because I am a newbie to Wicket ;).

 Just curious, why  do you want to escape  those characters?  Don't
 you  have your  page encoding  correctly set?   It should  display
 correctly, I for  one wouldn't need to  escape accented characters
 in the first place.

Well, I can do this. But I don't have much faith in the combination of 
HTML, modern browsers and special characters.
Escaping the umlauts is seemed to be the easiest (and effective) way 
avoiding problems. But if it is not possible to easily escape them with 
wicket I will try it.


Cheers,

Johannes Schneider

 Cheers,

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Escaping German Umlauts

2007-05-31 Thread Jean-Baptiste Quenot
* Johannes Schneider:

 can anyone  tell me how I  can escape German umlauts  when using
 TextFields  or  Labels?  Component.setEscapeModelStrings(  true)
 does  not replace  them. And I  really  don't want  to create  a
 custom IModel for every component I add

Have a look at Strings#escapeMarkup(String, boolean, boolean)

The  last argument  is called  convertToHtmlUnicodeEscapes and  by
reading the Javadoc I think it does what you want.

But now,  that doesn't mean you  can use it from  the Component or
FormComponent class.   We need to  find an acceptable  solution to
expose this feature to the Component level.  What do you propose?

Just curious, why  do you want to escape  those characters?  Don't
you  have your  page encoding  correctly set?   It should  display
correctly, I for  one wouldn't need to  escape accented characters
in the first place.

Cheers,
-- 
 Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user