Ruby can't eliminate garbled characters

Asked 2 years ago, Updated 2 years ago, 126 views

If you print Japanese in Ruby script, you will receive a Syntax Error.

I guess it's probably a character code problem, but all of them have UTF-8 configured and
There seems to be no problem and it's stuck.
If you know how to deal with it, I would like to ask you a question.

■ [ruby] p "a" Output

get_tdnet_data.rb:10:Invalid char`\x1B'in expression
get_tdnet_data.rb:10:syntax error, unexpected'(', expecting end-of-input
p "$" (B"

■[console]ruby --version Output

 ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-linux]

■[ruby] puts_ENCODING__ Output

UTF-8

■ [vi]: set enc? Output

encoding=utf-8

■ [Term] Setup>Terminal
receiving:UTF-8
sending:UTF-8

■[CentOS7]localectlOutput Results

System Locale:LANG=ja, UTF-8
       VC Keymap:jp106
      X11 Layout:jp

■[CentOS7]redhat-release Output

CentOS Linux release 7.6.1810 (Core)

ruby garbled-characters

2022-09-30 16:17

1 Answers

Thank you all for your cooperation
Due to configuration issues with vim
—set fenc=utf-8
resolved in .


2022-09-30 16:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.