|
28 | 28 | import java.io.IOException; |
29 | 29 | import java.io.InputStream; |
30 | 30 | import java.io.OutputStream; |
| 31 | +import java.nio.charset.StandardCharsets; |
31 | 32 |
|
32 | 33 | import com.sun.net.httpserver.Headers; |
33 | 34 |
|
@@ -87,21 +88,21 @@ public void skipWhitespace() throws IOException { |
87 | 88 |
|
88 | 89 | // efficient building of trimmed strings |
89 | 90 | static class StrBuilder { |
90 | | - private char buffer[] = new char[128]; |
| 91 | + private byte buffer[] = new byte[128]; |
91 | 92 | private int count=0; |
92 | 93 | public void append(int c) { |
93 | 94 | if(count==0 && c==' ') return; |
94 | 95 | if(count==buffer.length) { |
95 | | - char tmp[] = new char[buffer.length*2]; |
| 96 | + byte tmp[] = new byte[buffer.length*2]; |
96 | 97 | System.arraycopy(buffer,0,tmp,0,count); |
97 | 98 | buffer=tmp; |
98 | 99 | } |
99 | | - buffer[count++]=(char)c; |
| 100 | + buffer[count++]=(byte)c; |
100 | 101 | } |
101 | 102 | @Override |
102 | 103 | public String toString() { |
103 | 104 | while(count>0 && buffer[count-1]==' ') count--; |
104 | | - return new String(buffer,0,count); |
| 105 | + return new String(buffer,0,count,StandardCharsets.ISO_8859_1); |
105 | 106 | } |
106 | 107 | public boolean isEmpty() { |
107 | 108 | return count==0; |
|
0 commit comments