/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package utils;

/**
 *
 * @author lluis
 */
public class Utils {
    
	public static String unicodeToHTML( String text )
	{
		if( text == null || text.length() < 6 )
		{
			return text;
		}

		String output = text;
		output = output.replaceAll( "\\\\u0009", " " );
		output = output.replaceAll( "\\\\u000a", "<br>" );

		output = output.replaceAll( "\\\\u00a0", "&nbsp;" );
		output = output.replaceAll( "\\\\u00aa", "&ordf;" );
		output = output.replaceAll( "\\\\u00ba", "&ordm;" );

		output = output.replaceAll( "\\\\u00c0", "À" );
		output = output.replaceAll( "\\\\u00c1", "Á" );
		output = output.replaceAll( "\\\\u00c2", "Â" );
		output = output.replaceAll( "\\\\u00c3", "Ã" );
		output = output.replaceAll( "\\\\u00c7", "Ç" );
		output = output.replaceAll( "\\\\u00c8", "È" );
		output = output.replaceAll( "\\\\u00c9", "É" );
		output = output.replaceAll( "\\\\u00d3", "Ó" );
		output = output.replaceAll( "\\\\u00d2", "Ò" );                                
                
		output = output.replaceAll( "\\\\u00ca", "Ê" );
		output = output.replaceAll( "\\\\u00cc", "Ì" );
		output = output.replaceAll( "\\\\u00cd", "Í" );
		output = output.replaceAll( "\\\\u00ce", "Î" );
		output = output.replaceAll( "\\\\u00d2", "ò" );
		output = output.replaceAll( "\\\\u00d3", "ó" );
		output = output.replaceAll( "\\\\u00d4", "ô" );
		output = output.replaceAll( "\\\\u00d5", "õ" );
		output = output.replaceAll( "\\\\u00d9", "Ù" );
		output = output.replaceAll( "\\\\u00da", "Ú" );
		output = output.replaceAll( "\\\\u00db", "Û" );

		output = output.replaceAll( "\\\\u00e0", "à" );
		output = output.replaceAll( "\\\\u00e1", "á" );
		output = output.replaceAll( "\\\\u00e2", "â" );
		output = output.replaceAll( "\\\\u00e3", "ã" );
		output = output.replaceAll( "\\\\u00e7", "ç" );
		output = output.replaceAll( "\\\\u00e8", "è" );
		output = output.replaceAll( "\\\\u00e9", "é" );
		output = output.replaceAll( "\\\\u00ea", "ê" );
		output = output.replaceAll( "\\\\u00ec", "ì" );
		output = output.replaceAll( "\\\\u00ed", "í" );
		output = output.replaceAll( "\\\\u00ee", "î" );
		output = output.replaceAll( "\\\\u00f2", "ò" );
		output = output.replaceAll( "\\\\u00f3", "ó" );
		output = output.replaceAll( "\\\\u00f4", "ô" );
		output = output.replaceAll( "\\\\u00f5", "õ" );
		output = output.replaceAll( "\\\\u00f9", "ù" );
		output = output.replaceAll( "\\\\u00fa", "ú" );
		output = output.replaceAll( "\\\\u00fb", "û" );

		output = output.replaceAll( "\\\\u0153", "&#156;" );

		output = output.replaceAll( "\\\\u2013", "-" );
		output = output.replaceAll( "\\\\u2014", "-" );
		output = output.replaceAll( "\\\\u2018|\\\\u2019", "'" );
		output = output.replaceAll( "\\\\u201c|\\\\u201d", "\"" );

		output = output.replaceAll( "\\\\u2022", "*" );
		output = output.replaceAll( "\\\\u2026", "..." );

		return output;
	}     

}
