Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Ruby Console fails with some non-ascii characters ("Š") #17
When using "Š" character, SketchUp Ruby fails flat.
puts "ABCŠ " # Error: #<SyntaxError: <main>: invalid multibyte char (UTF-8) # <main>: unterminated string meets end of file> # SketchUp:1:in `eval' print "ABCŠ123456" # Error: SketchUp:1:in `eval'
Reported also in centercode SU-0396.
There is also no problem with the example under SU 2016.
@Nazz78, try the following at the console in both SU2017 and SU2018 & reports results (in a ```text block.)
puts "\n"<<'Sketchup version : ' << Sketchup.version puts 'External encoding : ' << Encoding.default_external.inspect puts 'Internal encoding : ' << Encoding.default_internal.inspect
As an example for SU2016, I get:
Okay, thanks, ... looks the same as always.
(1a) For SU2018, did you cut and paste the failing text from some other application window ?
What do you get when you type these at the console(s) ?
I'm also wondering if the
... should output the current working directory listing in the Ruby Console.
I get an error in any case, if I input it manually or if I copy/paste it.
In both, SU 17 and 18 I get the same result:
Okay, there is a difference from SU2016 where
I think the console gets it's input from STDIN.
If you get "Windows-1252", you could try ...
and try again.
Here is an Encoding Report generator script.
You drop the
It shows the difference when
@thomthom, It should be obvious that
file = __FILE__.dup # Account for Ruby encoding bug under Windows. file.force_encoding('UTF-8') if file.respond_to?(:force_encoding)
INSTEAD you just do ...
file = __FILE__.encode
P.S. it is NOT necessary to do
__FILE__.__id__ #=> 90762440 __FILE__.__id__ #=> 90761820 __FILE__.__id__ #=> 90761260 __FILE__.__id__ == __FILE__.__id__ #=> false __FILE__.equal?( __FILE__ ) #=> false