GBK码如何写入XML??如何转码以供socket传送用??请高手示下!

解决方案 »

  1.   

    参数描述MSDN上有详细描述,比如:
    WideCharToMultiByte
    The WideCharToMultiByte function maps a wide-character string to a new character string. The new character string is not necessarily from a multibyte character set. int WideCharToMultiByte(
      UINT CodePage,            // code page
      DWORD dwFlags,            // performance and mapping flags
      LPCWSTR lpWideCharStr,    // wide-character string
      int cchWideChar,          // number of chars in string.
      LPSTR lpMultiByteStr,     // buffer for new string
      int cbMultiByte,          // size of buffer
      LPCSTR lpDefaultChar,     // default for unmappable chars
      LPBOOL lpUsedDefaultChar  // set when default char used
    );
      

  2.   

    //写xml
    thisDataSet.WriteXml(filename,XmlWriteMode.DiffGram );
    //读xml
    thisDataSet.ReadXml(filename,XmlReadMode.DiffGram );