lib/zcc/zoomer.rb in zcc-0.0.3 vs lib/zcc/zoomer.rb in zcc-0.1.0

- old
+ new

@@ -53,17 +53,31 @@ # Tests leader of MARC21 records for character encoding # If leader position 9 is ' ' then convert to UTF-8. # If leader position 9 is 'a' then the record is already UTF-8. # Finally converts to xml + #def ZCC.convert_char rsetrec + # rec = MARC::Record.new_from_marc(rsetrec.raw) + # ldr9 = rec.leader[9, 1] + # return_rec = '' + # if ldr9 == ' ' + # return_rec = rsetrec.xml('MARC-8', 'UTF-8') + # elsif ldr9 == 'a' + # return_rec = rsetrec.xml + # else + # raise "Invalid value in leader 9 for MARC21" + # end + # return_rec + #end + def ZCC.convert_char rsetrec rec = MARC::Record.new_from_marc(rsetrec.raw) ldr9 = rec.leader[9, 1] return_rec = '' if ldr9 == ' ' - return_rec = rsetrec.xml('MARC-8', 'UTF-8') + return_rec = rsetrec.raw('MARC-8', 'UTF-8') elsif ldr9 == 'a' - return_rec = rsetrec.xml + return_rec = rsetrec.raw else raise "Invalid value in leader 9 for MARC21" end return_rec end