Incompatible character encodings loading .so files
-
We have a user running on Windows XP in Czechoslovakia.
When he tries to load our .so file with require he gets the error:
Error: #<Encoding::CompatibilityError: incompatible character encodings: Windows-1252 and UTF-8>
After some looking around we discovered that his plugins folder is in:
C:/Documents and Settings/Owner/Data aplikací/SketchUp/SketchUp 2014/SketchUp/Plugins
The last character of the phrase: "Data aplikací" is a Unicode character, and we have verified that this character is what is causing the problem. ("Data aplikací" is not his user name, but rather the path Windows uses in XP for the plugins folder)
Has anyone else run into a similar problem with Unicode characters in the plugins path, and (hopefully) found a solution?
-
This problem has been popping up all over and there are several other topics about it. Thom Thom in particular is trying to find a solid solution.
-
This particular problem went away when the user switched to Windows 7 from XP.
However, we have the same problem when a user has a unicode character in his name.
Sometimes we can get a user to change his/her user name. But this was a word from the Windows operation system which is probably harder to change.
Hopefully Thom Thom can think of something.
-
In this very week we suddenly got an array of these issues reported. :s
We're investigating. Please follow my thread at: http://sketchucation.com/forums/viewtopic.php?f=180%26amp;t=57017There are several issues at play here. I'll come back with a better overview once we've gotten the full picture.
-
Thanks TT. I knew, (or at least really hoped), that you would be on top of this.
We will try some of the ideas in the other thread and see if that helps.
-
So far I've found one workaround, that require a call to the Win32 API GetShortPahName function - take the folder part of the SO filename and convert it to DOS 8.3 style filename - then Ruby will load because it appear that Ruby is still calling the ASCII version of Windows' file functions in some cases.
Note, you must leave the actual name of the SO alone - only the folder path can be trunkated with GetShortPahName. -
Is GetShortPathName in ruby or in Win32API.so?
If it is in Win32API.so, is there a version of that anywhere we can use?
And where would we put it - since it is the Plugins Folder we cannot load things from.
I presume I could load Win32API.so from the Plugin folder if I did not need to give it a path name.
-
AL.. "Win32API.so" is replaced in Ruby 2.0 with a pure ruby wrapper script named "Win32API.rb" (It wraps old style Win32API calls into calls to the
DL
library.)So this wrapper script is included within SketchUp 2014's "RubyStdLib" folder.
You simply call:
require("Win32API") unless defined?(Win32API)
.. or you can
require("dl")
and makeDL
style calls.Do not copy old "Win32API.so" files from 1.8 Ruby into the "Plugins" folder for SketchUp v14 or higher !
-
@al hart said:
Is GetShortPathName in ruby or in Win32API.so?
Neither.
It is in "Kernel32.dll", and you use either
Win32API
orDL
class objects to wrap calls into that native library.See: [MSDN : GetShortPathName()](http://msdn.microsoft.com/en-us/library/windows/desktop/aa364989(v)
.. and since
DL
( really is deprecated, and now a wrapper intoFiddle
calls,):
Ruby : Fiddle library
Advertisement