offthefarm / cutlist

Automatically exported from code.google.com/p/cutlist
0 stars 0 forks source link

Support for export including international characters #14

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Generating a .csv file (for import into CutList plus) on a Sketchup model 
with international characters (UTC-8) causes a number of problems (see below)

What is the expected output? What do you see instead?

1) The generation crashes if the SkethUp model has a file path including 
national characters (UTC-8).
2) The generated file name gets corrupt if the SkethUp model has a file name 
including national characters.
3) Part/sub-assembly names including national characters are not correctly 
written to the generated file
4) The generation uses a comma to separate items even when the comma is used as 
a decimal separator which makes the export/import fail.

What version of the product are you using? On what operating system?
- CutList 4.1.7
- Sketchup 2013
- Windows 7

Please provide any additional information below.
It seems that all file handling only uses ASCII even though UTC-8 is set in 
Ruby. It would be great to have the import/export work also for international 
characters as both Sketchup and CutList Plus works fine.

Original issue reported on code.google.com by tho...@gmail.com on 20 Aug 2013 at 2:58

GoogleCodeExporter commented 8 years ago
I'll have a look into what may need to change. You are correct that Ruby 
supports UTC-8, however, the version of Ruby running when you run a plugin (ie: 
the version of Ruby built into Sketchup), does not! There are a few things that 
I am aware of which can be done to try to prevent mangling (using special ways 
of handling strings which tries to preserve UTC-8). I'll see if I can find a 
way to make this work. I am not the first to have the issue!

Wrt the use of comma as field separators, this is driven by the language 
setting in Sketchup. If I detect EN (en-US or en-GB) then I use comma because 
'.'  is used as the decimal and anything else uses ';' as the field separator 
since  ',' is used as the decimal. What language setting are you using in 
Sketchup?

Original comment by daltx...@gmail.com on 20 Aug 2013 at 6:10

GoogleCodeExporter commented 8 years ago
Great! 

I run the English version of Sketchup so Sketchup.get_locale returns EN-US. The 
problem is that numbers are printed with a comma  since I have that as a 
national setting (swedish).

Some hints:
- The html printing in CutList works fine.
- So does printing international characters to files via the Ruby Console. 
- $KCODE  reports UTF8 in the console.
- File.new, in the console, does not handle international characters in 
filenames nor paths.

Regards,
Mikael

Original comment by tho...@gmail.com on 20 Aug 2013 at 8:21

GoogleCodeExporter commented 8 years ago
Well, I put a lot of effort into this and found the source of the issue. 
However, there  is very little I can do about it. Sketchup supports an older 
version of Ruby to run for plugins and this older version cannot open a file as 
UTF-16. So, anytime a new file has to be written, the filename will not be set 
properly and the UTF-16 characters will be interpreted as UTF-8.

I'll find the right avenue to raise this issue with Trimble. Or keep searching 
to see if there is a workaround.

Sorry, I can't do more at this time!

Original comment by daltx...@gmail.com on 18 Nov 2013 at 7:59