Java tutorial
//package com.java2s; /* Copyright 2008 San Jose State University This file is part of the Blackberry Cinequest client. The Blackberry Cinequest client is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. The Blackberry Cinequest client 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 General Public License for more details. You should have received a copy of the GNU General Public License along with the Blackberry Cinequest client. If not, see <http://www.gnu.org/licenses/>. */ public class Main { private static char[] win1252_80_9f = { '\u20AC', '\u0081', '\u201A', '\u0192', '\u201E', '\u2026', '\u2020', '\u2021', '\u02C6', '\u2030', '\u0160', '\u2039', '\u0152', '\u008D', '\u017D', '\u008F', '\u0090', '\u2018', '\u2019', '\u201C', '\u201D', '\u2022', '\u2013', '\u2014', '\u02DC', '\u2122', '\u0161', '\u203A', '\u0153', '\u009D', '\u017E', '\u0178' }; /** * Replaces Windows 1252 characters with their Unicode equivalents. * @param buffer the buffer to be edited */ public static void fixWin1252(StringBuffer buffer) { for (int i = 0; i < buffer.length(); i++) { char ch = buffer.charAt(i); if ('\u0080' <= ch && ch <= '\u009F') buffer.setCharAt(i, win1252_80_9f[ch - '\u0080']); } } }