[Closed] Script malfunction: folder with swedish letters
I was using Batchcam2 the other day ( http://www.sergepogosyan.com/scripts/BatchCameraRender2/ ) and encountered a problem when saving to a target directory that had the å character in the folder.
The script itself creates some sort of a batch-file or process that opens a DOS-window and the å-letter turns into which ├à causes the 3dsmaxcmd.exe to halt.
I think the code that is causing this problem starts somewhere in row 2705 in the BatchCam2.0.8.ms file. This is part of the DOW-window output:
-outputName:"C:\Users\Haider\Desktop\+àre\Persp 001_Render.tga"
… which makes me think it has to do with
--get filename
attributeName = #presetPath
path_value = getPresetAttribute presetIndex attributeName
attributeName = #presetFile
file_value = getPresetAttribute presetIndex attributeName
if (isNotUndefined path_value) and (isNotUndefined file_value) and (Render_Output_Rollout.save_file.checked) then
(
fileName = (pathConfig.appendPath path_value file_value)
fileName = parse_file_name_template fileName (compose_camera_dictionary presetIndex)
format "-outputName:\"%\" " fileName to:submitString
setPresetAttribute presetIndex #presetPreviousAttempt fileName
Render_Output_Rollout.last_render_path.text = fileName
)
did some further tests to try to understand whats going on.
It appears it has to do with windows and character coding.
If I type this in the command prompt:
echo echo åäö>test.bat
… which means I create a bat file with the line “echo åäö” without the quote signs, the bat file works. It does echo the swedish letters correctly.
However, if I open the file in UltraEdit, it indicates correctly that the file is in DOS format, but the characters are rewritten to something else. In this case, the content of the bat-file is:
echo
The mentioned script creates the bat-file by filling it up with the format command, sending row after row to the batchCommandStringBuffer and finally it writes the bat-file:
(dotnetclass "System.IO.File").WriteAllText batchCommandFileName (batchCommandStringBuffer as string)
How can this be solved? Should the umlaut-letters be converted before writing the bat-file?
Does this work?
(dotnetclass "System.IO.File").WriteAllText batchCommandFileName (batchCommandStringBuffer as string) (dotNetClass "System.Text.Encoding").Default
I am afraid not. What more options are there beside .Default?
Now its writing the letters properly in the .Bat file. I want it to write it “unproperly”, so that e.g. the å character becomes a when you open the bat file. Because when you have it in the latter format, it will output it correctly.
Hope I was clear.
If that’s not possible, what do you think about creating a conversion list? Eg:
å =
ä =
ö =