Uploaded image for project: 'Commons Codec'
  1. Commons Codec
  2. CODEC-250

Wrong value calculated by Cologne Phonetic if a special character is placed between equal letters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5, 1.11
    • 1.12
    • None

    Description

      The algorith for cologne phonetic is (simpilied):

      1. Encode letter by letter from left to right according to the conversion table.
      2. Remove all digits occurring more than once next to each other.
      3. Remove all code "0" except at the beginning.

      Characters which are not specified in conversion table (such as hyphens) are ignored. See https://en.wikipedia.org/wiki/Cologne_phonetics

      If the input is "test-test" the step results will be:

      1. 20822082
      2. 2082082
      3. 28282

      The expected result for "test-test" is therefor 28282.

      The actual result for "test-test" is 282282.

      This bug is caused by the fix from

      https://github.com/apache/commons-codec/commit/72c8759a22c6552a2dfcdf61b29729f981752879

      and is present since 1.5

      Attachments

        1. CODEC250.patch
          0.9 kB
          Sebb
        2. ColognePhonetic.java
          4 kB
          Sebb

        Activity

          People

            Unassigned Unassigned
            xhelp Alex Volodko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 10m
                10m