-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When normalizing field contents for comparison AND the contents include invalid utf-8 byte encodings, try to transcode the string from marc-8 to utf-8 before continuing with the normalization. When the string is also not valid marc-8, use the unnormalized string for comparison.
- Loading branch information
Showing
4 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module MarcWrangler | ||
VERSION = '0.1.2.2'.freeze | ||
VERSION = '0.1.3'.freeze | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe MarcWrangler::ComparableField do | ||
describe '#norm_string' do | ||
xit 'normalizes utf-8 strings' do | ||
end | ||
|
||
it 'also handles marc-8 encoded strings' do | ||
marc8 = "$c\xC32008" | ||
expect(described_class.norm_string(marc8)).to eq('$c©2008') | ||
end | ||
|
||
context 'string is not valid utf-8 or marc-8' do | ||
it 'returns original, unnormalized, string' do | ||
str = "\xC8" | ||
expect(described_class.norm_string(str)).to eq(str) | ||
end | ||
end | ||
end | ||
end |