/**
 * Copyright (C) 2000 - 2009 Silverpeas
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * As a special exception to the terms and conditions of version 3.0 of
 * the GPL, you may redistribute this Program in connection with Free/Libre
 * Open Source Software ("FLOSS") applications as described in Silverpeas's
 * FLOSS exception.  You should have recieved a copy of the text describing
 * the FLOSS exception, and it is also available here:
 * "http://repository.silverpeas.com/legal/licensing"
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.silverpeas.tagcloud.model;

/**
 * Utilities class. Used to generate the correct spelling for the tag of a
 * tagcloud.
 */
public class TagCloudUtil {

  // List of characters used to generate a correct tag.
  // For each line, the characters contained in the first string has to be
  // replaced by the
  // character of the second string.
  private static final String[][] TAG_DATA = { { "(Ã‡)", "C" },
      { "(Ã€|Ã?|Ã‚|Ãƒ|Ã„|Ã…|Ã†)", "A" }, { "(Ãˆ|Ã‰|ÃŠ|Ã‹)", "E" },
      { "(ÃŒ|Ã?|ÃŽ|Ã?)", "I" }, { "(Ã’|Ã“|Ã”|Ã•|Ã–)", "O" },
      { "(Ã™|Ãš|Ã›|Ãœ)", "U" }, { "(Ã?)", "Y" } };

  /**
   * @param s
   *          The string to convert into a valid tag.
   * @return The tag corresponding to the string given as parameter.
   */
  public static String getTag(String s) {
    s = s.toUpperCase();
    for (int i = 0, n = TAG_DATA.length; i < n; i++) {
      s = s.replaceAll(TAG_DATA[i][0], TAG_DATA[i][1]);
    }
    return s;
  }

}
@@ -1267,20 +1267,16 @@
 tag of a
-%0D%0A *
  tagclou
@@ -1508,18 +1508,17 @@
 tring.%0D%0A
-  
+%09
 private 
@@ -1557,31 +1557,36 @@
  = %7B
- %7B %22(%C3%83%E2%80%A1
+%0D%0A    %7B%22(%C3%87
 )%22, 
+%09%09%09
 %22C%22
- 
 %7D,%0D%0A    
   %7B 
@@ -1585,138 +1585,121 @@
     
-  %7B %22(%C3%83%E2%82%AC%7C%C3%83?%7C%C3%83%E2%80%9A%7C%C3%83%C6%92%7C%C3%83%E2%80%9E%7C%C3%83%E2%80%A6%7C%C3%83%E2%80%A0
+%7B%22(%C3%80%7C%C3%81%7C%C3%82%7C%C3%83%7C%C3%84%7C%C3%85%7C%C3%86
 )%22, %22A%22
- 
 %7D,
- %7B %22(%C3%83%CB%86%7C%C3%83%E2%80%B0%7C%C3%83%C5%A0%7C%C3%83%E2%80%B9
+%0D%0A    %7B%22(%C3%88%7C%C3%89%7C%C3%8A%7C%C3%8B
 )%22, 
+%09%09
 %22E%22
- 
 %7D,%0D%0A
-  
     %7B
- 
 %22(
-%C3%83%C5%92%7C%C3%83?%7C%C3%83%C5%BD%7C%C3%83?
+%C3%8C%7C%C3%8D%7C%C3%8E%7C%C3%8F
 )%22, 
+%09%09
 %22I%22
- 
 %7D,
- %7B %22(%C3%83%E2%80%99%7C%C3%83%E2%80%9C%7C%C3%83%E2%80%9D%7C%C3%83%E2%80%A2%7C%C3%83%E2%80%93
+%0D%0A    %7B%22(%C3%92%7C%C3%93%7C%C3%94%7C%C3%95%7C%C3%96
 )%22, 
+%09
 %22O%22
- 
 %7D,%0D%0A    
   %7B 
@@ -1698,56 +1698,58 @@
     
-  %7B %22(%C3%83%E2%84%A2%7C%C3%83%C5%A1%7C%C3%83%E2%80%BA%7C%C3%83%C5%93
+%7B%22(%C3%99%7C%C3%9A%7C%C3%9B%7C%C3%9C
 )%22, 
+%09%09
 %22U%22
- 
 %7D,
+%0D%0A   
  %7B
- 
 %22(
-%C3%83?
+%C3%9D
 )%22, 
-%22Y%22 %7D 
+%09%09%09%22Y%22%7D%0D%0A%09
 %7D;%0D%0A
+%09
 %0D%0A  
@@ -1770,23 +1770,8 @@
 am s
-%0D%0A   *         
  The

Fixes UTF-8 encoding problem