Author Topic: Problem about Source Exporter plugin  (Read 3680 times)

Offline kingfox

  • Multiple posting newcomer
  • *
  • Posts: 41
Problem about Source Exporter plugin
« on: December 03, 2006, 01:45:27 pm »
When I try to export my C++ source code to a HTML file, if the destination directory which name includes Chinese character, the SoourceExporter plugin can't export the file. If I export the file to the directory which name is not includes Chinese character, the file can be exported. So, is it a bug of the Source Exporter plugin?

My environment: WinXP/SP2/CHS, MinGW/gcc 3.4.5, Code::Block Build Nov 30.

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Problem about Source Exporter plugin
« Reply #1 on: December 04, 2006, 03:46:03 am »
It's not a big surprise, but yeah, it's a bug in the plugin.

Since I use fstream to write to a file but get the filename from a wxString, the conversion can cause problems in some cases. Please file a bug report and assign it to me so I won't forget to check it.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Problem about Source Exporter plugin
« Reply #2 on: December 04, 2006, 11:14:11 am »
ofstream file(cbU2C(filename));

cbU2C() is probably a bad choice here since it possibly does not do the correct job under Windows in "Chinese" mode.
Windows expects a UTF-16 filename, but cbU2C() returns UTF-8. It may be worth trying wxString::fn_str() instead.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Problem about Source Exporter plugin
« Reply #3 on: December 04, 2006, 05:13:41 pm »
IIRC fn_str didn't work correctly for another program I was coding, but mb_str worked just fine. I had that problem when the path had accents and mb_str solved it. I'll just make those changes in the plugin and try to insert a chinese symbol in a path to be sure it works as expected.