Uploaded image for project: 'OpenOLAT'
  1. OpenOLAT
  2. OO-1403

FileUtils: replacing ß with ss

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1
    • Fix Version/s: 10.2
    • Component/s: None
    • Labels:
      None

      Description

      When normalizing filenames, it's useful to replace also all "ß" with "ss". You will also get into trouble with the danish dish Smørrebrød
      The Form.NFKD also replaces some ligatures like ffi (which is normally not needed )

      Here's the patch:

      diff -r 9b0040cc8b9c src/main/java/org/olat/core/util/FileUtils.java
      --- a/src/main/java/org/olat/core/util/FileUtils.java	Fri Jan 23 11:47:14 2015 +0100
      +++ b/src/main/java/org/olat/core/util/FileUtils.java	Mon Jan 26 14:29:37 2015 +0100
      @@ -840,7 +840,10 @@
       		nameFirstPass = nameFirstPass.replace("\u00E4", "ae");
       		nameFirstPass = nameFirstPass.replace("\u00F6", "oe");
       		nameFirstPass = nameFirstPass.replace("\u00FC", "ue");
      -		String nameNormalized = Normalizer.normalize(nameFirstPass, Normalizer.Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+","");
      +		nameFirstPass = nameFirstPass.replace("\u00DF", "ss");
      +		nameFirstPass = nameFirstPass.replace("\u00F8", "o");
      +		nameFirstPass = nameFirstPass.replace("\u00E6", "ae");
      +		String nameNormalized = Normalizer.normalize(nameFirstPass, Normalizer.Form.NFKD).replaceAll("\\p{InCombiningDiacriticalMarks}+","");
       		String nameSanitized = nameNormalized.replaceAll("\\W+", "");
       		return nameSanitized;
       	}
      

        Attachments

          Activity

            People

            • Assignee:
              srosse Stéphane Rossé
              Reporter:
              stephan Stephan Clemenz
              Tester:
              Florian Gnägi
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 30 minutes
                30m