LibreCat / Catmandu-MARC

Catmandu modules for working with MARC data
https://metacpan.org/release/Catmandu-MARC
Other
8 stars 10 forks source link

Catmandu dropping non-latin fields when exporting as MARCMaker #111

Closed powerriegel closed 2 years ago

powerriegel commented 2 years ago

When converting the attached file with the command catmandu convert MARC to MARC --type MARCMaker < oschrift_me.mrc

the non-latin fields are dropped. This happens only when exporting in MARCMaker, not in XML. oschrift_me.zip

Version 1.254 on Ubuntu 20.04. oschrift_me.zip

jorol commented 2 years ago

The problem is that MARCMaker uses usmarc_default() as default character set, which uses mnemonics for character encodings. See field 775 for example:

$ catmandu convert MARC to MARC --type MARCMaker < oschrift_me.mrc
...
=775  0\$tPolitiques en faveur des PME : Moyen-Orient m{caron}diterran{caron}en et Afrique du Nord 2018 : {C9}valuation interm{caron}diaire des principales r{caron}formes en faveur des PME$z9789264307612$z9789264308305$z9789264308299$efre
...

In Perl scripts you can use MARC::Charset to switch between encodings, see this Stackoverflow thread for example.

If you just want to create a line-based MARC format use yaz-marcdump with format line for conversion:

$ sudo apt install yaz
$ yaz-marcdump -i marc -o line oschrift_me.mrc 
03579cam a22003138i 4500
001 9789264310032-ar
003 FR-PaOEC
005 20201001000000.0
006 a     o  d i      
007 cr || |||m|n||
008 181201s2019    |||     o    i|0| 0 ara d
020    $a 9789264310032
035    $a (FR-PaOEC)
040    $a FR-PaOEC
110 2  $a Organisation for Economic Co-operation and Development.
245 10 $a منطقة الشرق الأوسط وشمال أفريقيا المتوسطية 2018 $h [electronic resource]: $b التقييم المرحلي للإصلاحات المتعلقة بالمشاريع الصغيرة والمتوسطة الحجم / $c Organisation for Economic Co-operation and Development, European Union and European Training Foundation
260    $a Paris : $b OECD Publishing, $c 2019.
300    $a 148 p. ; $c 21 x 28cm.
520 3  $a يقدم هذا التقرير تحليلاً معمقاً للإصلاحات الرئيسية التي أجريت بين 2014 و2018 التي تهدف إلى تشجيع تنمية المشاريع المتناهية الصغر والصغيرة والمتوسطة الحجم في الجزائر ومصر وإسرائيل والأردن ولبنان والمغرب والأراضي الفلسطينية وتونس. يركز التقرير على خمس مجالات استراتيجية لصياغة سياسات المشاريع الصغيرة والمتوسطة الحجم: تعاريف المشاريع الصغيرة والمتوسطة الحجم والإحصاءات والمؤسسات المتعلقة بها؛ تحسين بيئات العمل للمشاريع الصغيرة والمتوسطة الحجم ورواد الأعمال؛ تعزيز الوصول إلى التمويل؛ رعاية نمو الشركات الناشئة والمشاريع الصغيرة والمتوسطة الحجم؛ وتنمية رأس المال البشري الريادي. يهدف التقرير إلى عرض الممارسات الجيدة والإشارة إلى المناطق التي تحتاج إلى بذل المزيد من الجهود. ويوفر إرشادات قيمة للحكومات ومنظمات القطاع الخاص والهيئات المتعددة الأطراف وغيرها من أصحاب المصلحة لتكثيف الجهود لدعم المشاريع الصغيرة والمتوسطة الحجم كأدوات أساسية لخلق الوظائف والقدرة التنافسية. ويكتسي ذلك أهمية خاصة في منطقة تسعى إلى تعزيز التنوع الاقتصادي وخلق فرص العمل وإشراك الشباب والنساء في الاقتصاد. إن التقرير هو نتيجة لعملية تعاون وثيق بين الحكومات، ومنظمة التعاون والتنمية الاقتصادية، ومؤسسة التدريب الأوروبية والمفوضية الأوروبية
650  4 $a Finance and Investment
650  4 $a Governance
650  4 $a Development
650  4 $a Trade
650  4 $a Industry and Services
710 2  $a European Union.
710 2  $a European Training Foundation.
775 0  $t Politiques en faveur des PME : Moyen-Orient méditerranéen et Afrique du Nord 2018 : Évaluation intermédiaire des principales réformes en faveur des PME $z 9789264307612 $z 9789264308305 $z 9789264308299 $e fre
775 0  $t The Mediterranean Middle East and North Africa 2018: Interim Assessment of Key SME Reforms $z 9789264304161 $z 9789264306653 $z 9789264306646 $e eng
856 40 $a oecd-ilibrary.org $u https://doi.org/10.1787/9789264310032-ar
powerriegel commented 2 years ago

Isn't there an option to force another format? We use catmandu to prepare special records to test conversions. So, the conversion should work from mrc to mrk and vice-versa.

A little off-topic but still important for us: I really wonder, why this happens. We're using $marcFile = MARC::File::USMARC->in( $filename );for years and it never dropped any chars. There is only one other class:MARC::File::MicroLIF`, which seems to be something different. There is just no other MARC::File class, see https://metacpan.org/dist/MARC-Record

We're using this for thousands of records every day.

phochste commented 2 years ago

The problem is not with MARC::File::USMARC but another module MARC::File::MARCMaker (you mentioned in your ticket you want to use MARCMaker input). The reason that is never came up it probably all of us are processing USMARC for years but never had any MARCMaker production requirements.

Anyways the issue doesn't seem hard to solve. @jorol already made a ticket for that in the Catmandu-MARC project: https://github.com/LibreCat/Catmandu-MARC/issues/110

This will be soon fixed. If you have more questions could to continue to ask them in the Catmandu-MARC project? This space is more for general Catmandu questions.

phochste commented 2 years ago

Fixed in the 1.26 release now available on CPAN