[ https://issues.apache.org/jira/browse/LANG-623?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thomas Smets - A3 SYSTEM updated LANG-623: ------------------------------------------ Attachment: ConversionMappings.UTF8 This file in pure UTF-8 encoding (Eclipse or jEdit) is converted into a property-file through an ANT-task (native2ascii) : <echo>Converting ...</echo> <native2ascii encoding="UTF-8" src="${resources.dir}" dest="${build.dir}" includes="**/*.UTF8" ext=".properties" description="Conversion the weird foreign characters into proper UTF-8 escaped characters" /> <echo>Conversion done !</echo> > Replace characters seems to not be able to replace Icelanding Thorn (Þ, þ) > -------------------------------------------------------------------------- > > Key: LANG-623 > URL: https://issues.apache.org/jira/browse/LANG-623 > Project: Commons Lang > Issue Type: Bug > Affects Versions: 2.5 > Environment: W2K3-server / JDK 1.5 (from SAP) > Reporter: Thomas Smets - A3 SYSTEM > Attachments: ConversionMappings.UTF8 > > > Failing test case : > <snip> > @Ignore > public void convert_English_Thorn(){ > beforeConversion = "AAÞþaa"; > expectedAfterConversion = "aattaa"; > Assert.assertEquals("Test NOT correctly configured length not > correct", > beforeConversion.length(), > expectedAfterConversion.length()); > afterConversion = converter.replaceAccents(beforeConversion); > Assert.assertEquals("Cannot convert (Icelandic/old english thorn) '" > + beforeConversion + "'.", expectedAfterConversion, afterConversion); > } > </snip> > <snip> > /** > * This method replace some characters (typically accented characters > with their no accented counterpart). > * The mapping are defined in the file loaded by {...@link > #loadNameConversionFile(String)} from the <code>classpath</code>. > * > * @param aField > * @return a lowercase version of the String with all the special > character replaced > * > * @see #removeWeirdCharactersFromName(String) > * @see StringUtils#lowerCase(String) > * @see String#replaceAll(String, String) > */ > String replaceAccents(final String aField) { > String result = StringUtils.lowerCase(aField), > target = null, > charsToRemove = null; > char charToPut = Constants.UNDERSCORE_CHARACTER, > charToRemove = Constants.UNDERSCORE_CHARACTER; > for (Object element : conversionMappings.keySet()) { > target = element.toString(); > if (target.equals(Constants.SPECIAL_CHARACTER_KEY)) { > continue; > } > result = StringUtils.stripToNull(result); > charsToRemove = conversionMappings.getProperty(target, > Constants.EMPTY_STRING).toString(); > charToPut = target.charAt(Constants.ZERO); > for (int i=0; i<charsToRemove.length(); i++) { > charToRemove = charsToRemove.charAt(i); > result = StringUtils.replaceChars(result, charToRemove, > charToPut); > } > } > return result; > } > </snip> -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.