ivan.cuevas Posted November 20, 2013 Share Posted November 20, 2013 Hi all, my problem is I'm not able to convert input parameters from command line arguments. This is the code sample: #include <samples/systems/common/systems.h> /* */ void update_scene() { ; } /* */ void create_scene() { forloop(int i=0 ; engine.getNumArgs()) { if(engine.getArg(i) == "--msg") { log.message("param:%s", engine.getArg(i+1)); break; } } return "Application arguments"; } /* */ void clear_scene() { } If I run the sample with the following arguments: main_x86.exe -engine_config ..\data\unigine.cfg -console_command "world_load samples\systems\arguments" --msg cañón I get the wrong representation of the argument, so in the log file appears: 18:13:10 param:ca��n (instead of cañón) I suppose it's because wndows input parameters are codified in a different way that Unigine interprets it (Utf-8) How can I convert this string argument to Utf-8? I don't have this problem in OSX and Linux because they always work in Utf-8. Thanks in advance, Iván. Link to comment
unclebob Posted November 22, 2013 Share Posted November 22, 2013 Hi Ivan! Sorry for late reply. Try to use 'chcp 65001' command in your console. Also, here is a cool topic on stack overflow: http://stackoverflow.com/questions/388490/unicode-characters-in-windows-command-line-how I tried 'chcp 65001' and it's not working well for russian symbols, but 'chcp 1251' did the job for me. So try different codepages. Link to comment
ivan.cuevas Posted November 25, 2013 Author Share Posted November 25, 2013 Hi uncleboob, At the end I made it work with using a .bat file and codepage 1252. Thanks. Link to comment
Recommended Posts