Lines 244-249
define( function() {
Link Here
|
244 |
// happens before UTF-8 encoding, but that won't cause any issues. |
244 |
// happens before UTF-8 encoding, but that won't cause any issues. |
245 |
data = _encode_utf8(data.substr(0, parseInt(data.substr(0, 5)))); |
245 |
data = _encode_utf8(data.substr(0, parseInt(data.substr(0, 5)))); |
246 |
|
246 |
|
|
|
247 |
// For now, we can't decode MARC-8, so just mark the record as possibly corrupted. |
248 |
if (data[9] != 'a') { |
249 |
var marc8 = true; |
250 |
} |
251 |
|
247 |
this._fieldlist.length = 0; |
252 |
this._fieldlist.length = 0; |
248 |
this.leader(data.substr(0, 24)); |
253 |
this.leader(data.substr(0, 24)); |
249 |
var directory_len = parseInt(data.substring(12, 17), 0) - 25, |
254 |
var directory_len = parseInt(data.substring(12, 17), 0) - 25, |
Lines 254-259
define( function() {
Link Here
|
254 |
len = parseInt(data.substring(off+3, off+7), 0) - 1, |
259 |
len = parseInt(data.substring(off+3, off+7), 0) - 1, |
255 |
pos = parseInt(data.substring(off+7, off+12), 0) + 25 + directory_len, |
260 |
pos = parseInt(data.substring(off+7, off+12), 0) + 25 + directory_len, |
256 |
value = data.substring(pos, pos+len); |
261 |
value = data.substring(pos, pos+len); |
|
|
262 |
|
263 |
// No end-of-field character before this field, corruption! |
264 |
if (marc8 && data[pos - 1] != '\x1E') { |
265 |
this.marc8_corrupted = true; |
266 |
} |
267 |
|
257 |
if ( parseInt(tag) < 10 ) { |
268 |
if ( parseInt(tag) < 10 ) { |
258 |
this.addField( new MARC.Field( tag, '', '', [ [ '@', value ] ] ) ); |
269 |
this.addField( new MARC.Field( tag, '', '', [ [ '@', value ] ] ) ); |
259 |
} else { |
270 |
} else { |