In windows: visual studio code IDE,I wrote the command like:
ruby -E UTF-8 -e "puts '汤姆,Welcome to my home'" > test.txt
,then I use the command:
ruby -E UTF-8 -e "puts gets" < test.txt
,but error codes occurred when reading.Like:
��ķ,Welcome to my home.
Finally I found the "test.txt" file's encoding type is unicode.
If I insist on using IO redirection to a file and choose kernel.puts, how can I ensure that the stored file's encoding type is UTF-8?
What should I do to ensure that the file encoding type after redirection is UTF-8?Please help me.