Skip to content

Commit efad294

Browse files
committed
Use Character.toUpper instead of String.toUpperCase to simplify porting to .NET Standard
1 parent db220b4 commit efad294

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/org/jsoup/helper/DataUtil.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import java.io.RandomAccessFile;
1515
import java.nio.ByteBuffer;
1616
import java.nio.charset.Charset;
17-
import java.util.Locale;
1817
import java.util.Random;
1918
import java.util.regex.Matcher;
2019
import java.util.regex.Pattern;
@@ -211,7 +210,11 @@ private static String validateCharset(String cs) {
211210
if (cs == null || cs.length() == 0) return null;
212211
cs = cs.trim().replaceAll("[\"']", "");
213212
if (PortUtil.charsetIsSupported(cs)) return cs;
214-
cs = cs.toUpperCase(Locale.ENGLISH);
213+
StringBuilder upperCase = new StringBuilder();
214+
for (int i = 0; i < cs.length(); i++) {
215+
upperCase.append(Character.toUpperCase(cs.charAt(i)));
216+
}
217+
cs = upperCase.toString();
215218
if (PortUtil.charsetIsSupported(cs)) return cs;
216219
// if our this charset matching fails.... we just take the default
217220
return null;

0 commit comments

Comments
 (0)