创建一系列 XML 编码的 ASCII
 //ASCII to To XML Encoding char map. 
 //Each index in the array represents a ASCII char, and the corresponding XML          
 //endcoded string.
//AB 2013/08/02
static const char m_arrAsciiMap[256][8] 
= 
{
    "�",  "",  "",  "",  "",  "",  "",  "",  "",  "	",  "
",  "",  "",  "
",  "",  "",
    "",  "",  "",  "",  "",  "",  "",  "",  "",  "",  "",  "",  "",  "",  "",  "",
    " ",  "!",  """,  "#",  "$",  "%",  "&",  "'",  "(",  ")",  "*",  "+",  ",",  "-",  ".",  "/",
    "0",  "1",  "2",  "3",  "4",  "5",  "6",  "7",  "8",  "9",  ":",  ";",  "<",  "=",  ">",  "?",
    "@",  "A",  "B",  "C",  "D",  "E",  "F",  "G",  "H",  "I",  "J",  "K",  "L",  "M",  "N",  "O",  
    "P",  "Q",  "R",  "S",  "T",  "U",  "V",  "W",  "X",  "Y",  "Z",  "[",  "\",  "]",  "^",  "_",  
    "`",  "a",  "b",  "c",  "d",  "e",  "f",  "g",  "h",  "i",  "j",  "k",  "l",  "m",  "n",  "o",
    "p",  "q",  "r",  "s",  "t",  "u",  "v",  "w",  "x",  "y",  "z",  "{",  "|",  "}",  "~",  "",  
    "€",  "",  "‚",  "ƒ",  "„",  "…",  "†",  "‡",  "ˆ",  "‰",  "Š",  "‹",  "Œ",  "",  "Ž",  "",  
    "",  "‘",  "’",  "“",  "”",  "•",  "–",  "—",  "˜",  "™",  "š",  "›",  "œ",  "",  "ž",  "Ÿ",  
    " ",  "¡",  "¢",  "£",  "¤",  "¥",  "¦",  "§",  "¨",  "©",  "ª",  "«",  "¬",  "­",  "®",  "¯",
    "°",  "±",  "²",  "³",  "´",  "µ",  "¶",  "·",  "¸",  "¹",  "º",  "»",  "¼",  "½",  "¾",  "¿",
    "À",  "Á",  "Â",  "Ã",  "Ä",  "Å",  "Æ",  "Ç",  "È",  "É",  "Ê",  "Ë",  "Ì",  "Í",  "Î",  "Ï",  
    "Ð",  "Ñ",  "Ò",  "Ó",  "Ô",  "Õ",  "Ö",  "×",  "Ø",  "Ù",  "Ú",  "Û",  "Ü",  "Ý",  "Þ",  "ß",  
    "à",  "á",  "â",  "ã",  "ä",  "å",  "æ",  "ç",  "è",  "é",  "ê",  "ë",  "ì",  "í",  "î",  "ï",
    "ð",  "ñ",  "ò",  "ó",  "ô",  "õ",  "ö",  "÷",  "ø",  "ù",  "ú",  "û",  "ü",  "ý",  "þ",  "ÿ",
};
//函数将所有非 XML 允许的 ASCII 字符转换为 //XML 编码字符串
void XMLEncodeString(char *pDestBuffer, char *SourceBuffer)
{
    int buffLen = strlen(SourceBuffer);
    int CurrentPointerPos = 0;  
    for(int i = 0; i < buffLen; i++)
    {
        if ((((BYTE)SourceBuffer[i]) >= 32 && ((BYTE)SourceBuffer[i]) <= 37)                        
         || (((BYTE)SourceBuffer[i]) == 39 )
         || (((BYTE)SourceBuffer[i]) >= 42 && ((BYTE)SourceBuffer[i]) <= 59) 
         || (((BYTE)SourceBuffer[i]) >= 64 && ((BYTE)SourceBuffer[i]) <= 122))
        {
//Check if the Chars are allowed, if yes then dont convert to XML encoded string
//Numbers, Alphabets upper and lower case can be ignored, certain special chars 
// can also be ignored
            pDestBuffer[CurrentPointerPos] = SourceBuffer[i];
            CurrentPointerPos++;
        }
        else
        {
//If the char is not allowed in XML string convert it to the XML encoded equivalent. 
//Replace the single char with the XML encoded string e.g < with <
            memcpy((pDestBuffer + CurrentPointerPos),  m_arrAsciiMap[(BYTE)SourceBuffer[i]], strlen(m_arrAsciiMap[(BYTE)SourceBuffer[i]]));
            CurrentPointerPos += strlen(m_arrAsciiMap[(BYTE)SourceBuffer[i]]);
        }
    }
}