Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ia

  • Loading branch information...
commit 2e7b5392a483272cb793aeeb9fa440de58546a2e 1 parent f40ac8e
@kafka0102 authored
View
4 src/main/java/org/xhttpproxy/util/encoding/PageEncodingDetector.java
@@ -12,7 +12,7 @@
.getLogger(PageEncodingDetector.class);
private static Pattern pattern = Pattern
- .compile("(charset='([^']+)')|(charset=\"([^\"]+)\")|(charset=([^ \"']+))");
+ .compile("(charset=[^\\w-]*([\\w-]+)[^\\w-]*)");
@Override
public String detect(byte[] text) throws EncodingException {
@@ -60,7 +60,7 @@ private boolean isValidCharset(String charset) {
public static void main(String[] args) throws Exception {
PageEncodingDetector detector = new PageEncodingDetector();
- String text = " content=\"text/html; charset=UTF-8\"";
+ String text = " content=\"text/html; charset=' UTF-8 '\"";
System.out.println(detector.detect(text.getBytes()));
}
}

0 comments on commit 2e7b539

Please sign in to comment.
Something went wrong with that request. Please try again.