From 9e79f94c7d03c4a12c542a5453a5cbbdbd7ddfbd Mon Sep 17 00:00:00 2001 From: Gary Spencer Date: Fri, 8 Jun 2007 08:54:48 +0000 Subject: [PATCH] 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 --- .../alfresco/filesys/ftp/FTPSrvSession.java | 28 ++++--------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/source/java/org/alfresco/filesys/ftp/FTPSrvSession.java b/source/java/org/alfresco/filesys/ftp/FTPSrvSession.java index 9fb059dff0..1d8204a932 100644 --- a/source/java/org/alfresco/filesys/ftp/FTPSrvSession.java +++ b/source/java/org/alfresco/filesys/ftp/FTPSrvSession.java @@ -77,6 +77,8 @@ import org.alfresco.service.transaction.TransactionService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import com.ibm.icu.text.Normalizer; + /** * FTP Server Session Class * @@ -117,7 +119,7 @@ public class FTPSrvSession extends SrvSession implements Runnable // Enabled features - protected static boolean FeatureUTF8 = false; + protected static boolean FeatureUTF8 = true; protected static boolean FeatureMDTM = true; protected static boolean FeatureSIZE = true; protected static boolean FeatureMLST = true; @@ -234,26 +236,6 @@ public class FTPSrvSession extends SrvSession implements Runnable 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 * @@ -4170,8 +4152,8 @@ public class FTPSrvSession extends SrvSession implements Runnable if ( isUTF8Enabled()) { // 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 {