Copy&pasting in eeschema fails (TBS characters & locale dependent) (GTK-specific?) (lp:#1831890)

[Original report](https://bugs.launchpad.net/bugs/1831890) created by **Tom Crane (tomcrane2)**
```
I have had problems copying and pasting certain individual components,
using the right-click method for both.  The symptom was no-effect when
right-click pasting despite the paste menu item not being greyed out.

Further investigation showed the components (eg. SM resistors) which would
not copy&paste had top-bit-set characters in some of their fields whereas
otherwise identical components without such characters copy&pasted OK. Here
is an example of a problem component
definition;

$Comp
L Device:R R8
U 1 1 5CCB92EB
P 4800 6150
F 0 "R8" V 4700 6050 50  0000 C CNN
F 1 "10k" V 4700 6200 50  0000 C CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 4730 6150 50  0001 C CNN
F 3 "https://docs-emea.rs-online.com/webdocs/14ae/0900766b814ae02e.pdf" H
4800 6150 50  0001 C CNN
F 4 "10kΩ 0805 Thin Film Surface Mount Fixed Resistor ±1% 0.125W
CRT0805-FZ-1002ELF" V 4800 6150 50  0001 C CNN "Data"
F 5 "RS Stock No. 740-9224" V 4800 6150 50  0001 C CNN "Order code"
        1    4800 6150
        -1   0    0    1
$EndComp

Here is a hexdump of the above,
00000000 24 43 6f 6d 70 0a 4c 20 44 65 76 69 63 65 3a 52   $Comp.L Device:R
00000010 20 52 38 0a 55 20 31 20 31 20 35 43 43 42 39 32    R8.U 1 1 5CCB92
00000020 45 42 0a 50 20 34 38 30 30 20 36 31 35 30 0a 46   EB.P 4800 6150.F
00000030 20 30 20 22 52 38 22 20 56 20 34 37 30 30 20 36    0 "R8" V 4700 6
00000040 30 35 30 20 35 30 20 20 30 30 30 30 20 43 20 43   050 50  0000 C C
00000050 4e 4e 0a 46 20 31 20 22 31 30 6b 22 20 56 20 34   NN.F 1 "10k" V 4
00000060 37 30 30 20 36 32 30 30 20 35 30 20 20 30 30 30   700 6200 50  000
00000070 30 20 43 20 43 4e 4e 0a 46 20 32 20 22 52 65 73   0 C CNN.F 2 "Res
00000080 69 73 74 6f 72 5f 53 4d 44 3a 52 5f 30 38 30 35   istor_SMD:R_0805
00000090 5f 32 30 31 32 4d 65 74 72 69 63 22 20 56 20 34   _2012Metric" V 4
000000a0 37 33 30 20 36 31 35 30 20 35 30 20 20 30 30 30   730 6150 50  000
000000b0 31 20 43 20 43 4e 4e 0a 46 20 33 20 22 68 74 74   1 C CNN.F 3 "htt
000000c0 70 73 3a 2f 2f 64 6f 63 73 2d 65 6d 65 61 2e 72   ps://docs-emea.r
000000d0 73 2d 6f 6e 6c 69 6e 65 2e 63 6f 6d 2f 77 65 62   s-online.com/web
000000e0 64 6f 63 73 2f 31 34 61 65 2f 30 39 30 30 37 36   docs/14ae/090076
000000f0 36 62 38 31 34 61 65 30 32 65 2e 70 64 66 22 20   6b814ae02e.pdf"
00000100 48 20 34 38 30 30 20 36 31 35 30 20 35 30 20 20   H 4800 6150 50
00000110 30 30 30 31 20 43 20 43 4e 4e 0a 46 20 34 20 22   0001 C CNN.F 4 "
00000120 31 30 6b ce a9 20 30 38 30 35 20 54 68 69 6e 20   10k.. 0805 Thin
00000130 46 69 6c 6d 20 53 75 72 66 61 63 65 20 4d 6f 75   Film Surface Mou
00000140 6e 74 20 46 69 78 65 64 20 52 65 73 69 73 74 6f   nt Fixed Resisto
00000150 72 20 c2 b1 31 25 20 30 2e 31 32 35 57 20 43 52   r ..1% 0.125W CR
00000160 54 30 38 30 35 2d 46 5a 2d 31 30 30 32 45 4c 46   T0805-FZ-1002ELF
00000170 22 20 56 20 34 38 30 30 20 36 31 35 30 20 35 30   " V 4800 6150 50
00000180 20 20 30 30 30 31 20 43 20 43 4e 4e 20 22 44 61     0001 C CNN "Da
00000190 74 61 22 0a 46 20 35 20 22 52 53 20 53 74 6f 63   ta".F 5 "RS Stoc
000001a0 6b 20 4e 6f 2e 20 37 34 30 2d 39 32 32 34 22 20   k No. 740-9224"
000001b0 56 20 34 38 30 30 20 36 31 35 30 20 35 30 20 20   V 4800 6150 50
000001c0 30 30 30 31 20 43 20 43 4e 4e 20 22 4f 72 64 65   0001 C CNN "Orde
000001d0 72 20 63 6f 64 65 22 0a 20 20 20 20 20 20 20 20   r code".
000001e0 31 20 20 20 20 34 38 30 30 20 36 31 35 30 0a 20   1    4800 6150.
000001f0 20 20 20 20 20 20 20 2d 31 20 20 20 30 20 20 20          -1   0
00000200 20 30 20 20 20 20 31 20 20 20 0a 24 45
6e 64 43    0    1   .$EndC
00000210 6f 6d 70 0a                                       omp.


Duplication always worked but of course was no use for copying between
sheets.

After some more investigation I discovered changing the LANG setting in my
locale enabled all components to be copy&pasted.  Previously I had
LANG=en_GB (originally needed due to limitations in the window manager I
use).  Changing it to en_GB.UTF-8 fixed the
problem.

See also test.sch attached. With LANG=en_GB set component R8 (with TBS
characters) cannot be copy&pasted but R9 (without TBS characters can be
copy&pasted).  With en_GB.UTF-8 set both components can be copied&pasted.

I know there have been other problems with copy&pasting in the past. Could
I make a feature-request for a diagnostic printed message/GUI pop-up to be
produced when the copy to the clipboard or the paste from it fails, rather
than just silently failing which is
frustrating and not helpful for problem diagnosis?

Thanks
Tom Crane

Ps. this problem was first reported in kicad-
developers@lists.launchpad.net.

Kicad detail:
Application: KiCad
Version: (5.1.0-868-g0ea75cb4e), release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.65.0 OpenSSL/1.1.1c zlib/1.2.11 libidn2/2.2.0 libpsl/0.21.0
(+libidn2/2.1.1) libssh2/1.8.2 nghttp2/1.38.0
Platform: Linux 4.19.47 x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.69.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.65.0
    Compiler: GCC 9.1.0 with C++ ABI 1013
Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=OFF
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON
```
Original tags: eeschema

Story points: 6.0