本帖最后由 小菜123 于 2022-5-22 16:34 编辑
解决UTF-8等文本文件读入乱码问题
- ;;;by小菜 测试 (read_txt_file_as_encoding "f:\\test.txt" "utf-8")
- (defun read_txt_file_as_encoding (FileName encoding / bstr stream byxiaocai)
- (setq stream (vlax-create-object "ADODB.Stream"))
- (vlax-put-Property stream 'type 2)
- (Vlax-Put-Property stream 'Charset encoding)
- (Vlax-Invoke stream 'open)
- (vlax-invoke-method stream 'LoadFromFile FileName)
- (setq bstr (Vlax-Invoke-Method stream 'readtext -1))
- (Vlax-Invoke-Method stream 'close)
- (vlax-release-object stream)
- bstr
- )
|