asciiEncoder.reset().canEncode(...)

This commit is contained in:
Vhati 2017-12-30 09:32:52 -05:00
parent d8c22515a0
commit 505f57f43e
3 changed files with 6 additions and 5 deletions

View file

@ -329,7 +329,7 @@ public class FTLPack extends AbstractPack {
if ( pathToIndexMap.containsKey( innerPath ) ) {
throw new IOException( "InnerPath already exists: "+ innerPath );
}
if ( !asciiEncoder.canEncode( innerPath ) ) {
if ( !asciiEncoder.reset().canEncode( innerPath ) ) {
throw new IllegalArgumentException( "InnerPath contains non-ascii characters: "+ innerPath );
}

View file

@ -266,7 +266,7 @@ public class PkgPack extends AbstractPack {
char c = (char)srcBuf.get();
if ( c == '\0' ) break;
if ( !asciiEncoder.canEncode( c ) ) {
if ( !asciiEncoder.reset().canEncode( c ) ) {
throw new IOException( String.format( "Unexpected non-ASCII char in null-terminated string: %X", c ) );
}
@ -276,7 +276,7 @@ public class PkgPack extends AbstractPack {
}
private int writeNullTerminatedString( ByteBuffer dstBuf, CharSequence s ) throws IOException {
if ( !asciiEncoder.canEncode( s ) ) {
if ( !asciiEncoder.reset().canEncode( s ) ) {
throw new IllegalArgumentException( "The PKG format does not support non-ascii characters: "+ s );
}
@ -577,7 +577,7 @@ public class PkgPack extends AbstractPack {
if ( pathToIndexMap.containsKey( innerPath ) ) {
throw new IOException( "InnerPath already exists: "+ innerPath );
}
if ( !asciiEncoder.canEncode( innerPath ) ) {
if ( !asciiEncoder.reset().canEncode( innerPath ) ) {
throw new IllegalArgumentException( "InnerPath contains non-ascii characters: "+ innerPath );
}

View file

@ -459,7 +459,7 @@ public class ModUtilities {
innerPath = innerPath.replace( '\\', '/' );
}
if ( !asciiEncoder.canEncode( innerPath ) ) {
if ( !asciiEncoder.reset().canEncode( innerPath ) ) {
pendingMsgs.add( new ReportMessage(
ReportMessage.ERROR,
String.format( "Non-ASCII characters in path." )
@ -576,6 +576,7 @@ public class ModUtilities {
modValid = false;
}
// Found chars unique to windows-1252.
if ( decodeResult.encoding.equalsIgnoreCase( "windows-1252" ) ) {
pendingMsgs.add( new ReportMessage(
ReportMessage.WARNING,