he problem here is specifying the charset, properties factory is global so
you might encode your files one way but a jar you use with components might
have them encoded in another charset - so we cannot really have a global
charset specified. i think the proper thing to do is use xml properties
format where you specify charset/file

-igor


On 7/19/07, wheleph <[EMAIL PROTECTED]> wrote:
>
>
> I've solved the problem in the following way:
>
> 1. I've created CustomPropertiesFactory subclass of PropertiesFactory and
> put it in wicket.resource package (to get access to
> wicket.resource.Properties' package-private constructor)
>
> package wicket.resource;
> ...
> public class CustomPropertiesFactory extends PropertiesFactory {
>         private String charset;
>
>         public CustomPropertiesFactory(final String charset) {
>                 this.charset = charset;
>         }
>
>         private synchronized Properties loadPropertiesFile(final String
> key,
>                         final IResourceStream resourceStream, final Class
> componentClass,
>                         final String style, final Locale locale) {
> ...
>                                         // this is the custom line
>                                         properties.load(
>                                                         new
> InputStreamReader(
>                                                         new
> BufferedInputStream(
>
> resourceStream.getInputStream()),
>                                                         charset));
> //                                      properties.load(new
> BufferedInputStream(resourceStream
>
> //                                                      .getInputStream()));
>                                         strings = new
> ValueMap(properties);
> ...
>         }
> ...
> }
>
> 2. I've attached the instance of class given above to application:
> public class EcoApplication extends SpringWebApplication {
>
> ...
>         @Override
>         public final void init() {
>                 // this line is important
>                 // for spring-injection through annotations
>                 addComponentInstantiationListener(new
> SpringComponentInjector(this));
> // here is the attachment
>                 getSettings().setPropertiesFactory(new
> CustomPropertiesFactory("cp1251"));
>         }
> }
> --
> View this message in context:
> http://www.nabble.com/.properties-encoding-tf4110226.html#a11690737
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to