Home > Net >  C # to do android app
C # to do android app

Time:11-19

When using c # write read mobile phone text file to an insurmountable problem, bosses, give advice or comments, please


Encoding TxtEncoding=GetType (filename);
FileStream fs=new FileStream (filename, FileMode. Open, FileAccess. Read);
MemoryStream ms=new MemoryStream ();
Fs. CopyTo (ms);
Ms. Position=0;
Ms. Seek (0, SeekOrigin. Begin);



When the mobile phone text file is utf8 format string can be used books.=Encoding utf8. Get string (Ms. GetBuffer ());
, but when using the computer simulator debugging format for gb2312,
Books.=Encoding GetEncoding (' gb2312). Get string (Ms. GetBuffer ());//register GB2312 encoding name code 936
Through can convert.
Packaged into APK on the mobile phone after installation error the following
'gb312' is not a supported encoding name. For information on defining a custom encoding, see the documentation For the encoding. RegisterProvider method. The Parameter name: the name


In the project reference System. Text. Encoding. CodePages. DLL file

The code to add
System. Text. Encoding. RegisterProvider (System. Text. CodePagesEncodingProvider. Instance);

Then try to convert
Books=Encoding. GetEncoding (936). Get string (Ms. GetBuffer ());
Again, there is an error below
Encoding 936 data could not be found. Make sure you have correct international codeset assembly installed and enabled


Could you tell me how to operate? To identify the coding,

  •  Tags:  
  • C#
  • Related