You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The actual question is the character encoding of the base64 decoded byte sequence stored in bytes. When storing this byte sequence as String (UTF-16), the platform's default charset matters:
I suggest implementing some simple encoding detection at this point and constructing the string platform independent similar to:
if(isUTF8(bytes)) {
s = new String(bytes, Charset.forName("UTF-8"));
}
else {
final String latin = new String(bytes, Charset.forName("ISO-8859-1"));
final byte[] lbytes = latin.getBytes(Charset.forName("UTF-8"));
s = new String(lbytes);
}
Actually, the list of expected charsets should be configurable.
The text was updated successfully, but these errors were encountered:
This issue is based on #19, which targets the character encoding used during http authentication.
I expect the following change to be useless, because
enc
is the codepage independent base64 string. No need to require any special character set.milton2/milton-api/src/main/java/io/milton/http/Auth.java
Line 225 in 2feff46
The actual question is the character encoding of the base64 decoded byte sequence stored in
bytes
. When storing this byte sequence as String (UTF-16), the platform's default charset matters:milton2/milton-api/src/main/java/io/milton/http/Auth.java
Line 226 in 2feff46
I suggest implementing some simple encoding detection at this point and constructing the string platform independent similar to:
Actually, the list of expected charsets should be configurable.
The text was updated successfully, but these errors were encountered: