diff src/luan/webserver/RequestParser.java @ 1266:05934fbf635a

content-type "application/x-www-form-urlencoded; charset=utf-8"
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 30 Sep 2018 19:10:48 -0600
parents e8020216dee7
children c214cd0413dd
line wrap: on
line diff
--- a/src/luan/webserver/RequestParser.java	Tue Sep 25 19:51:34 2018 -0600
+++ b/src/luan/webserver/RequestParser.java	Sun Sep 30 19:10:48 2018 -0600
@@ -19,12 +19,12 @@
 		this.request = request;
 	}
 
-	void parseUrlencoded() throws ParseException {
+	void parseUrlencoded(String charset) throws ParseException, UnsupportedEncodingException {
 		if( request.body == null ) {
 			logger.warn("body is null\n"+request.rawHead);
 			return;
 		}
-		this.parser = new Parser(Util.toString(request.body));
+		this.parser = new Parser(Util.toString(request.body,charset));
 		parseQuery();
 		require( parser.endOfInput() );
 	}
@@ -191,7 +191,7 @@
 
 	private static final String contentTypeStart = "multipart/form-data; boundary=";
 
-	void parseMultipart() throws ParseException {
+	void parseMultipart() throws ParseException, UnsupportedEncodingException {
 		if( request.body == null ) {
 			logger.warn("body is null\n"+request.rawHead);
 			return;
@@ -200,7 +200,7 @@
 		if( !contentType.startsWith(contentTypeStart) )
 			throw new RuntimeException(contentType);
 		String boundary = "--"+contentType.substring(contentTypeStart.length());
-		this.parser = new Parser(Util.toString(request.body));
+		this.parser = new Parser(Util.toString(request.body,null));
 //System.out.println(this.parser.text);
 		require( parser.match(boundary) );
 		boundary = "\r\n" + boundary;