eeschema for Windows fails to deal with Cyrillic (Unicode)

Bug #1483693 reported by Tim N. Tashpulatov
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Undecided
jean-pierre charras

Bug Description

eeschema fails to load a previously created component with Cyrillic pin names in it, resulting in error message:

error <error 'pin only had 6 parameters of the required 11 or 12' in DRAW command X> occurred at line 4387

Ref and Value fields seem to have no problems with Unicode whatsoever.

Application: eeschema
Version: (2015-08-05 BZR 6055, Git fa29c62)-product release build
wxWidgets: Version 3.0.2 (debug,wchar_t,compiler with C++ ABI 1009,GCC 5.2.0,wx containers,compatible with 2.8)
Platform: Windows XP (build 2600, Service Pack 3), 32 bit, Little endian, wxMSW
Boost version: 1.57.0
         USE_WX_GRAPHICS_CONTEXT=OFF
         USE_WX_OVERLAY=OFF
         KICAD_SCRIPTING=ON
         KICAD_SCRIPTING_MODULES=ON
         KICAD_SCRIPTING_WXPYTHON=ON
         USE_FP_LIB_TABLE=HARD_CODED_ON
         BUILD_GITHUB_PLUGIN=ON

summary: - eeschema fails to deal wih Cyrillic (Unicode)
+ eeschema for Windows fails to deal with Cyrillic (Unicode)
Revision history for this message
Tim N. Tashpulatov (tim-tashpulatov) wrote :

Probably something could fail in the following line of code in bool LIB_PIN::Load( LINE_READER& aLineReader, wxString& aErrorMsg ) call:

i = sscanf( line + 2, "%255s %63s %d %d %d %63s %d %d %d %d %63s %63s", pinName,
                pinNum, &m_position.x, &m_position.y, &m_length, pinOrient, &m_numTextSize,
                &m_nameTextSize, &m_Unit, &m_Convert, pinType, pinAttrs );

http://bazaar.launchpad.net/~kicad-product-committers/kicad/product/view/head:/eeschema/lib_pin.cpp#L733

Revision history for this message
jean-pierre charras (jp-charras) wrote :

Kicad uses UFT8 to store/read its files.

I tested it and no issue on Windows (Although it is not easy for me to test cyrillic text).
No issues for the pin name.
pin num text is limited (currently) to 4 bytes (4 ascii letters, or 2 cyrillic letters) but no read issue

Was this file created by a old kicad version ?
Have you edited this file "by hand" with a non UTF8 editor?

if no, send us this file.

Revision history for this message
Tim N. Tashpulatov (tim-tashpulatov) wrote :

Hi Jean-Pierre, and thank you for your courage in dealing with Cyrillics :)

The library file was trimmed from existing one (74 logic lib). I am attaching it along with screenshot of how it looks like in Notepad.

Now, the tricky part begins. I have tried to change pin names to other Russian words, like 'Input' and 'Output', and it worked OK, I then recalled another Russian user complaining about the same issue with Russian words starting with Russian 'R' letter (visually looks like Latin P), and changed pin names to start with Russian 'R'. Et voila! It just won't load.

Revision history for this message
Tim N. Tashpulatov (tim-tashpulatov) wrote :

Attached is .lib file

Revision history for this message
Eldar Khayrullin (eldar) wrote :

I am not see errors (file: всячина.lib).

Application: kicad
Version: 0.201508100901+6080~28~ubuntu15.04.1-product release build
wxWidgets: Version 3.0.2 (debug,wchar_t,compiler with C++ ABI 1002,GCC 4.9.2,wx containers,compatible with 2.8)
Platform: Linux 3.19.0-25-generic x86_64, 64 bit, Little endian, wxGTK
Boost version: 1.54.0
         USE_WX_GRAPHICS_CONTEXT=OFF
         USE_WX_OVERLAY=OFF
         KICAD_SCRIPTING=ON
         KICAD_SCRIPTING_MODULES=ON
         KICAD_SCRIPTING_WXPYTHON=ON
         USE_FP_LIB_TABLE=HARD_CODED_ON
         BUILD_GITHUB_PLUGIN=ON

Revision history for this message
Tim N. Tashpulatov (tim-tashpulatov) wrote :

Eldar, the problem only exists with Windows version of eeschema.

Revision history for this message
Eldar Khayrullin (eldar) wrote :

Ok.

Changed in kicad:
assignee: nobody → jean-pierre charras (jp-charras)
status: New → Confirmed
Revision history for this message
jean-pierre charras (jp-charras) wrote :

Should be fixed in rev 6085.
Can you test in with more cases.

Changed in kicad:
status: Confirmed → Fix Committed
Revision history for this message
Maxim (lupan-m-g) wrote :

"Pin name" work fine now, but "component name" doesn't work.

Revision history for this message
jean-pierre charras (jp-charras) wrote :

Send me the library which have issues.
My test library works.

Revision history for this message
Maxim (lupan-m-g) wrote :

Some strange with it. If i add "ИР" component, save and load, bug appear. But if add something, save and load again, magic happens, all work fine.

Revision history for this message
Maxim (lupan-m-g) wrote :

Many thanks for fix anyway. Practically there are no situations in which this kind it would be critical.

Jon Neal (reportingsjr)
Changed in kicad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.