Switched to using the ICU4J library to normalize the UTF-8 strings after conversion from a byte array. AR-1507.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5892 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gary Spencer 2007-06-08 08:54:48 +00:00
parent 97e6fc07df
commit 9e79f94c7d

View File

@ -77,6 +77,8 @@ import org.alfresco.service.transaction.TransactionService;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import com.ibm.icu.text.Normalizer;
/** /**
* FTP Server Session Class * FTP Server Session Class
* *
@ -117,7 +119,7 @@ public class FTPSrvSession extends SrvSession implements Runnable
// Enabled features // Enabled features
protected static boolean FeatureUTF8 = false; protected static boolean FeatureUTF8 = true;
protected static boolean FeatureMDTM = true; protected static boolean FeatureMDTM = true;
protected static boolean FeatureSIZE = true; protected static boolean FeatureSIZE = true;
protected static boolean FeatureMLST = true; protected static boolean FeatureMLST = true;
@ -234,26 +236,6 @@ public class FTPSrvSession extends SrvSession implements Runnable
private TreeConnectionHash m_connections; private TreeConnectionHash m_connections;
/**
* Static initializer
*/
static
{
try
{
// Check if the sun.text classes are available for UTF-8 conversion
Class.forName( "sun.text.Normalizer");
// Enable UTF-8 support
FeatureUTF8 = true;
}
catch ( Exception ex)
{
}
}
/** /**
* Class constructor * Class constructor
* *
@ -4171,7 +4153,7 @@ public class FTPSrvSession extends SrvSession implements Runnable
{ {
// Convert the string from UTF-8 // Convert the string from UTF-8
cmd = sun.text.Normalizer.compose( new String(m_inbuf, 0, rdlen, "UTF-8"), false, 0); cmd = Normalizer.compose( new String(m_inbuf, 0, rdlen, "UTF-8"), false);
} }
else else
{ {