Using Dir.pwd with Cyrillic user-name etc




One encoding issue noted here is whether the following methods can be used when the current folder contains ‘non-english’ characters. I tested with a folder name of テストАнтонŠ, as the first three characters are used in Ruby’s tests.

File.absolute_path '.'
File.expand_path '.'
File.realpath '.'

As I suspected, Ruby 2.4.4 fails, but both Ruby 2.5.1 and trunk pass. No encodings were changed, hence Encoding.default_internal reports nil.

Some Misc Notes re Ruby & SU (related, but a ‘step back’):

As I’ve mentioned, full testing of Ruby on Windows only began last year with the ruby-loco MinGW builds and Ruby’s own mswin build. Since last year (2017) was the development of Ruby 2.5, it had all windows related fixes applied, some of which could not be backported to 2.4 or 2.3. Also, some popular gems (both standard & extension) are being tested with current versions of Ruby & trunk on Windows.

1. For those who have wondered about SU and the (old) version of Ruby it uses, one see’s the abbreviation ‘API’, which stands for Application Programming Interface. In Ruby discussions the term ‘ABI’ is also used, and it refers to ‘Application Binary Interface’.

The ABI defines the set of c function calls in Ruby. It is these functions that SU uses to connect to Ruby’s dll or dylib files. Note that these files are identical to the files used in stand-alone Ruby versions. The ABI in Ruby is relatively stable, but starting with Ruby 2.4, the ABI’s for Bignum and Fixnum were removed and replaced with Integer. So, for Trimble to update Ruby to 2.4 or later, it will require updating (and testing) SU code that was probably written a long time ago. For most plugins, this won’t be an issue, but for code using the SU C SDK, it may.

2. Frozen string - when enabled, SU 2018 is not happy. I hope that the included SU extensions can be updated to work correctly with this setting, along with corrections for the warnings that are often listed on startup.

Trimble is not responsible for ‘Ruby on Windows’ issues, nor would I expect them to be aware of all of them. But, the sooner they update to 2.5+, the sooner plugin authors can remove ‘compatibility code’ from their plugins that’s required to work around the Windows issues with versions prior to 2.5.

Apologies to anyone who feels reading this last section was a waste of time. In the ‘Ruby world’, I’ve seen people complain that the Ruby core team was not responsive to Windows issues. I have not found that to be the case. Likewise, here, in ‘SU world’, people often blame Ruby or Trimble, and in my opinion, sometimes that blame is not deserved.

Thanks, Greg