You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 4, 2020. It is now read-only.
Hello. I have simple data collected from YAZ commands.
yaz-client -m catalogue.dat
I am connecting to library which has MARC21 format and UTF-8 encoding.
I am saving records to catalogue.dat file. It's CZECH library so titles are with special characters for example Ř or Ě etc. when i will run this code:
def get_books(request):
with open('catalogue.dat', 'rb') as fh:
reader = MARCReader(fh)
for record in reader:
print(str(record.title()))
return HttpResponseRedirect('/')
I believe it defaults to marc8 encoding, try changing your with open line to: with open('catalogue.dat', to_unicode=True, force_utf8=True, 'rb') as fh:
From the MARCReader class docstring in the marc8.py file:
If you find yourself in the unfortunate position of having data that
is utf-8 encoded without the leader set appropriately you can use
the force_utf8 parameter:
Not sure, if that's the particular problem you're having, but that might help. Though, you might need to remove the to_unicode=True portion that I recommended.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello. I have simple data collected from YAZ commands.
yaz-client -m catalogue.dat
I am connecting to library which has MARC21 format and UTF-8 encoding.
I am saving records to catalogue.dat file. It's CZECH library so titles are with special characters for example Ř or Ě etc. when i will run this code:
Console will print this:
So basicly there are two issues. First why it prints couldn't find errors and why it prints data without that special characters? Thank you so much.
The text was updated successfully, but these errors were encountered: