#include <tchar.h> #include <memory> //For STL auto_ptr class //--------------------------------------------------------------------------- #pragma argsused int _tmain(int argc, _TCHAR* argv[]) { // Sample to convert a file of any encoding to UTF8 TEncoding *LEncoding = NULL; std::auto_ptr<TFileStream> LFileStream(new TFileStream("..\\Sample.txt", fmOpenRead)); // Read file into buffer. TBytes myBytes; std::auto_ptr<TBytesStream> myBytesStream(new TBytesStream(myBytes)); myBytesStream->CopyFrom(LFileStream.get(), LFileStream->
delphi TEncoding
最新推荐文章于 2024-03-09 06:00:00 发布
这篇博客介绍了Delphi中如何使用TEncoding进行字符编码的转换,特别是从GBK(代码页936)到UTF8的转换。通过示例代码展示了如何保存Memo组件的文本到文件时指定UTF8编码,并且讨论了去除UTF8 BOM的处理方式。
摘要由CSDN通过智能技术生成