Failed to read RBE/RBS file - Unicode character in username (Windows 7, SU2016)
Getting this error in SketchUp Make 2016 when trying to load an RBS file in a path containing Unicode characters (username is “HD INFORMÁTICA” in the example below). Tested in Windows 7 32-bit but I believe the same would happen in other Windows versions, 32 or 64-bit. RBS file was generated with the scrambler found here. Works fine if placed in a path without Unicode characters.
Error Loading File C:/Users/HD INFORMÁTICA/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/bimbon/main.rbs
Failed to read RBE/RBS file.
Is there a way to load an RBS file in a Windows path with Unicode characters? Or the only way is to use an RB file instead of an RBS one? Or maybe there’s something wrong in my code? force_encoding("UTF-8")
wasn’t enough to fix this error.
I know about the %ProgramData%
workaround but I would rather not have to ask users in this situation to move files around…
Any help is appreciated
Thanks
Extension folder structure:
bimbon/
bimbon/icon.png
bimbon/lib/
bimbon/lib/sketchup_json/
bimbon/lib/sketchup_json/generator.rb
bimbon/lib/sketchup_json/parser.rb
bimbon/loader.rb
bimbon/main.rbs
bimbon/reload.png
bimbon.rb
Relevant files below.
bimbon.rb:
# encoding: utf-8
module Bimbon
current_path = File.dirname(__FILE__)
if current_path.respond_to?(:force_encoding)
current_path.force_encoding("UTF-8")
end
VERSION = "1.0"
MAINFILE = "main.rbs"
PLUGIN_ROOT_PATH = current_path.freeze
PLUGIN_PATH = File.join(PLUGIN_ROOT_PATH, 'bimbon').freeze
end
Sketchup::require "extensions"
bimbon_extension = SketchupExtension.new("bim.bon", File.join(Bimbon::PLUGIN_PATH, "loader.rb"))
bimbon_extension.version = Bimbon::VERSION
bimbon_extension.creator = "..."
bimbon_extension.copyright = "..."
bimbon_extension.description = "..."
Sketchup.register_extension(bimbon_extension, true)
bimbon/loader.rb:
# encoding: utf-8
Sketchup::require "bimbon/main"