Thanks for your prompt answer. I already read about the encoding on wiki.
The code that does the logic is in XmlPullParser.java:

if (this.encoding == null)
    {
    // Use JVM default
    bin.reset();
    markup = Streams.readString(bin);
    }
else
    {
    // Use the encoding as specified in <?xml encoding=".." ?>
    // Don't re-read <?xml ..> again
    // Ignore ALL characters preceding <?xml>
    markup = Streams.readString(bin, encoding);
    }

The Streams.readString uses java.io.InputStreamReader with default or
supplied encoding. It is also clear that settings.setDefaultLocale() will
not be in action.

I think that there should be more control over the input markup encoding. I
cannot change the JVM default encoding (or can I?) and if I want to produce
XHTML that will switch IE into standards compliant mode (see
http://www.wellstyled.com/html-doctype-and-browser-mode.html), I have to
ommit XML declaration.

Fortunately I found a solution (at least for Wicket 1.0). I will override
the configureResponse() method. The body will be the same as the
Page.configureResponse(), I will just comment out the
response.write(markupStream.getXmlDeclaration());

Side note: Wicket is bright new and nice package, I am surpriced that it
doesn't support HTML 4.0 / XHTML Strict mode standards and that nobody
complains about it. The samples for Wicket are not valid.

Jan

> the current implementation copies the <?xml?> from the page's
> markup to the output. It is used to determine the encoding of
> the markup file and in case of the Page the encoding of the
> output. In case any of the remaining component's contains
> <?xml?> it is used to determine the encoding of the markup
> only and character are automatically converted into the
> output encoding.
>
> Having sad that, I think there is currently no solution to
> not copy it to the output. Additional comments please see below.
>
> On 7/6/05, Jan Bares <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > we would like to produce pages in utf-8 encoding. This
> works fine if
> > the <?xml version="1.0" encoding="UTF-8"?> is in the source markup.
> > However
> the
> > rendered pages should not contain the <?xml?> declaration.
> This is due
> > to quirk/standard mode of IE. XML standard says, that if a XML file
> > doesn't have the <?xml?> declaration, it is assumed to be
> coded in utf-8.
> >
> > Can you help me with this problem? I see several solutions:
> >
> > 1. Set the output encoding for each page - I would like to
> avoid this
> > solution
>
> this is possible, but doesn't prevent wicket from copying
> <?xml?> from page markup to output.
>
> > 2. Remove the <?xml?> declaration from output - how can I do this?
>
> I don't think there is solution available right now.
>
> > 3. Can I tell to Wicket configuration that all markup pages
> are in utf-8?
>
> If no <?xml?> is available Wicket uses the values inherited
> from the OS (the current process), provided you have not
> changed Wickets default locale by means of
> settings.setDefaultLocale(). Though I'm not sure (I haven't
> tested it), that we are using these default locale for markup
> files as well. Could you do me a favour and test that? Thanks a lot.
>
> > 4. If the XHTML DOCTYPE is present and no <?xml?> declaration is
> > found,
> use
> > utf-8 as default
> >
>
> Honestly, I do not like this kind of "magic". To "complex"
> and you end up with lots of these "exceptions".
>
> In case you haven't read it already
> http://wicket.sourceforge.net/wiki/index.php/Markup_encoding.
> I guess it does not answer your questions, but may give you
> some more hints.
>
> Juergen
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration
> Strategies from IBM. Find simple to follow Roadmaps,
> straightforward articles, informative Webcasts and more! Get
> everything you need to get up to speed, fast.
> http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick
>





-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to