You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Joerg Schaible (JIRA)" <ji...@apache.org> on 2010/05/21 09:21:17 UTC
[jira] Commented: (LANG-623) Replace characters seems to not be able to replace Icelanding Thorn (Þ, þ)
[ https://issues.apache.org/jira/browse/LANG-623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12869902#action_12869902 ]
Joerg Schaible commented on LANG-623:
-------------------------------------
This test can only proof something if Thomas set the encoding option of the compiler to utf-8. Otherwise the test is simply wrong. Therefore it is always a bad idea to put non-ASCII characters directly into source.
> 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
> Components: lang.*
> Affects Versions: 2.5
> Environment: W2K3-server / JDK 1.5 (from SAP)
> Reporter: Thomas Smets - A3 SYSTEM
> Attachments: ConversionMappings.UTF8
>
>
> Failing test case :
> {code}
> @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);
> }
> {code}
> {code}
>
> 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;
> }
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.