Java Char Convert To charToCp1252(char c)

Here you can find the source of charToCp1252(char c)

Description

char To Cp

License

Open Source License

Declaration

public static byte charToCp1252(char c) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static byte charToCp1252(char c) {
        byte byteVal;
        if (c > 0 && c < '\u0080' || c >= '\u00a0' && c <= '\u00ff') {
            byteVal = (byte) c;
        } else if (c == '\u20ac') {
            byteVal = (byte) -128;
        } else if (c == '\u201a') {
            byteVal = (byte) -126;
        } else if (c == '\u0192') {
            byteVal = (byte) -125;
        } else if ('\u201e' == c) {
            byteVal = (byte) -124;
        } else if (c == '\u2026') {
            byteVal = (byte) -123;
        } else if ('\u2020' == c) {
            byteVal = (byte) -122;
        } else if (c == '\u2021') {
            byteVal = (byte) -121;
        } else if ('\u02c6' == c) {
            byteVal = (byte) -120;
        } else if (c == '\u2030') {
            byteVal = (byte) -119;
        } else if (c == '\u0160') {
            byteVal = (byte) -118;
        } else if (c == '\u2039') {
            byteVal = (byte) -117;
        } else if ('\u0152' == c) {
            byteVal = (byte) -116;
        } else if ('\u017d' == c) {
            byteVal = (byte) -114;
        } else if ('\u2018' == c) {
            byteVal = (byte) -111;
        } else if ('\u2019' == c) {
            byteVal = (byte) -110;
        } else if (c == '\u201c') {
            byteVal = (byte) -109;
        } else if ('\u201d' == c) {
            byteVal = (byte) -108;
        } else if ('\u2022' == c) {
            byteVal = (byte) -107;
        } else if ('\u2013' == c) {
            byteVal = (byte) -106;
        } else if ('\u2014' == c) {
            byteVal = (byte) -105;
        } else if (c == '\u02dc') {
            byteVal = (byte) -104;
        } else if ('\u2122' == c) {
            byteVal = (byte) -103;
        } else if ('\u0161' == c) {
            byteVal = (byte) -102;
        } else if (c == '\u203a') {
            byteVal = (byte) -101;
        } else if (c == '\u0153') {
            byteVal = (byte) -100;
        } else if ('\u017e' == c) {
            byteVal = (byte) -98;
        } else if ('\u0178' == c) {
            byteVal = (byte) -97;
        } else {/*from  ww w  .  j  av  a  2s. com*/
            byteVal = (byte) 63;
        }
        return byteVal;
    }
}

Related

  1. charToBoolean(char c)
  2. charToBuffer(char ch, byte[] ioBuffer)
  3. charToCDATA(char ch)
  4. charToCompressedBaseLow(final int base)
  5. charToCompressedBaseLow(final int base)
  6. charToDecimal(char c)
  7. charToDigit(char c)
  8. charToEscape(char ch)
  9. charToHTML(char ch, boolean xml)