cancel
Showing results for 
Search instead for 
Did you mean: 

how to save text date to new file

sumire
Level 8
typo in title: data (not date)


I want to save text data to new html file (utf-8) and put it in my PC desktop.
My PC system locale is set to ja-jp, so file is saved in shift-JIS by default.
Please tell me how to do.
Thanks.

------------------------------
Mitsuko
Asia/Tokyo
------------------------------
------------------------------
Mitsuko
Asia/Tokyo
------------------------------
1 BEST ANSWER

Best Answers

sumire
Level 8
I copied and rewrite VBO "write text file" so that it can output text in UTF-8.

namespace System.IO and System.Text  are required.

Dim utfEnc = System.Text.Encoding.GetEncoding(65001)

Try
	File.WriteAllText(File_Name, inText, utfEnc)

	Success = True
	Message = ""
Catch e As Exception
	Success = False
	Message = e.Message
End Try​


------------------------------
Mitsuko
Asia/Tokyo
------------------------------
------------------------------
Mitsuko
Asia/Tokyo
------------------------------

View answer in original post

1 REPLY 1

sumire
Level 8
I copied and rewrite VBO "write text file" so that it can output text in UTF-8.

namespace System.IO and System.Text  are required.

Dim utfEnc = System.Text.Encoding.GetEncoding(65001)

Try
	File.WriteAllText(File_Name, inText, utfEnc)

	Success = True
	Message = ""
Catch e As Exception
	Success = False
	Message = e.Message
End Try​


------------------------------
Mitsuko
Asia/Tokyo
------------------------------
------------------------------
Mitsuko
Asia/Tokyo
------------------------------