asciiEncoder.reset().canEncode(...)
This commit is contained in:
parent
d8c22515a0
commit
505f57f43e
3 changed files with 6 additions and 5 deletions
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue