Fixed lookahead code which was swallowing ?xml encoding header tag.


git-svn-id: https://svn.apache.org/repos/asf/incubator/wicket/trunk@456308 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/wicket-examples/src/java/wicket/examples/helloworld/HelloWorld.html b/wicket-examples/src/java/wicket/examples/helloworld/HelloWorld.html
index 4610586..8fe32ff 100644
--- a/wicket-examples/src/java/wicket/examples/helloworld/HelloWorld.html
+++ b/wicket-examples/src/java/wicket/examples/helloworld/HelloWorld.html
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <html xmlns:wicket='http://wicket.sourceforge.net/wicket'>
 <head>
     <title>Wicket Examples - helloworld</title>
diff --git a/wicket/src/java/wicket/markup/parser/XmlPullParser.java b/wicket/src/java/wicket/markup/parser/XmlPullParser.java
index 26f19b7..df76ced 100644
--- a/wicket/src/java/wicket/markup/parser/XmlPullParser.java
+++ b/wicket/src/java/wicket/markup/parser/XmlPullParser.java
@@ -290,6 +290,7 @@
 			// If no, return the whole line. determineEncoding will read-ahead
 			// at max. the very first line of the markup
 			this.encoding = determineEncoding(bin, readAheadSize);
+			bin.reset();
 
 			// Depending on the encoding determined from the markup-file, read
 			// the rest either with specific encoding or JVM default
@@ -297,7 +298,6 @@
 			if (this.encoding == null)
 			{
 				// Use JVM default
-				bin.reset();
 				markup = Streams.readString(bin);
 			}
 			else
diff --git a/wicket/xdocs/changes.xml b/wicket/xdocs/changes.xml
index 9a995e7..3110d74 100644
--- a/wicket/xdocs/changes.xml
+++ b/wicket/xdocs/changes.xml
@@ -8,6 +8,9 @@
   </properties>
   <body>
   	<release version="1.0-RC1" date="t.b.d." description="1.0 release candidate 1">
+      <action type="fix" dev="Jonathan Locke" issue="1166432">
+      Fixed lookahead code which was swallowing ?xml encoding header tag.
+      </action>
       <action type="update" dev="Jonathan Locke" issue="">
 		Added two convenient ways of constructing shared resources.  The first by calling
 		getShared() on an existing Resource.  The second by using an implementation of