← Back to team overview

kicad-developers team mailing list archive

Re: PATCH: fix kicad2step non-ASCII filename problem in MinGW

 

On 3/7/2017 9:35 AM, Nick Østergaard wrote:
> 2017-03-07 14:40 GMT+01:00 Wayne Stambaugh <stambaughw@xxxxxxxxx>:
>> Cirilo,
>>
>> Just to be sure I have this correct,  I need to apply this patch to the
>> master branch and build oce with the previous patch you sent correct?
>> What I intend to do is apply this patch and add the mingw-oce patch to
>> our patches folder.
>>
>> @Orson, didn't you create the oce PKGBUILD file for the msys2 project?
>> If so, would you please add this patch to the PKGBUILD and submit a pull
>> request to fix this so we don't have to build oce to have a UTF8 file
>> support on windows.
> 
> @Orson, don't waste time on this. I can handle this.

Thank you Nick for stepping up to handle this.

> 
>>
>> Thanks,
>>
>> Wayne
>>
>>
>> On 3/7/2017 1:07 AM, Cirilo Bernardo wrote:
>>> The attached patch is the latest version and fixes the non-ASCII
>>> filename chars issue in kicad2step. If OCE is built in MinGW
>>> with the hack I provided then everything works as expected
>>> under Windows+MinGW.
>>>
>>> The sole difference with the previous patch is that kicad2step.cpp
>>> was modified to replace:
>>>
>>> wxIMPLEMENT_APP_CONSOLE( KICAD2MCAD );
>>>
>>> with
>>>
>>> wxIMPLEMENT_APP( KICAD2MCAD );
>>>
>>> I don't understand why one works but not the other. The
>>> CONSOLE version results in a main( int, char** ) type of
>>> entry point and the Windows CRT converts UTF16 to ASCII,
>>> which naturally fails for most UTF16 code points. I presume
>>> a similar problem will exist for other external tools such as
>>> idf2vrml.
>>>
>>> I guess for now we have to look at this as a workaround for
>>> a bug in wxWidgets + MinGW. I suspect things start to go
>>> wrong in wx/app.h:
>>>
>>> #if wxUSE_UNICODE && defined(__VISUALC__)
>>>     #define wxIMPLEMENT_WXWIN_MAIN_CONSOLE                                    \
>>>         int wmain(int argc, wchar_t **argv)                                   \
>>>         {                                                                     \
>>>             wxDISABLE_DEBUG_SUPPORT();                                        \
>>>                                                                               \
>>>             return wxEntry(argc, argv);                                       \
>>>         }
>>> #else // Use standard main()
>>>     #define wxIMPLEMENT_WXWIN_MAIN_CONSOLE                                    \
>>>         int main(int argc, char **argv)                                       \
>>>         {                                                                     \
>>>             wxDISABLE_DEBUG_SUPPORT();                                        \
>>>                                                                               \
>>>             return wxEntry(argc, argv);                                       \
>>>         }
>>> #endif
>>>
>>> I tried to change #if wxUSE_UNICODE && defined(__VISUALC__)
>>> to include __MINGW32__ and __MINGW64__, but a subsequent
>>> build told me WinMain() was not found. I gave up trying to find
>>> the specific problem at that point.
>>>
>>> - Cirilo
>>>
>>>
>>> On Sun, Mar 5, 2017 at 3:52 PM, Cirilo Bernardo
>>> <cirilo.bernardo@xxxxxxxxx> wrote:
>>>> This patch fixes the non-ASCII filename problem in
>>>> Windows+MinGW.
>>>>
>>>> When this patch is applied, and OCE is built under
>>>> MinGW with the patch I previously supplied, all
>>>> 3D model viewing and STEP export appear to work
>>>> mostly as expected. There is one remaining
>>>> issue to resolve which is correctly passing the
>>>> UTF8 filename from pcbnew to kicad2step and
>>>> ensuring that the appropriate output file is created.
>>>> At the moment I'm not sure if the problem is in
>>>> kicad2step or my hack of OCE, but I'm looking
>>>> into it.
>>>>
>>>> - Cirilo
>>>>
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>> More help   : https://help.launchpad.net/ListHelp
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp


References