lib/dwc-archive/classification_normalizer.rb in dwc-archive-0.7.1 vs lib/dwc-archive/classification_normalizer.rb in dwc-archive-0.7.2

- old
+ new

@@ -56,15 +56,13 @@ end private def get_canonical_name(a_scientific_name) - if R19 - a_scientific_name.force_encoding('utf-8') - end + a_scientific_name.force_encoding('utf-8') canonical_name = @parser.parse(a_scientific_name, :canonical_only => true) - canonical_name.to_s.empty? ? a_scientific_name : canonical_name + canonical_name.to_s.empty? ? a_scientific_name : canonical_name.force_encoding('utf-8') end def get_fields(element) data = element.fields.inject({}) { |res, f| res[f[:term].split('/')[-1].downcase.to_sym] = f[:index].to_i; res } data[:id] = element.id[:index] @@ -124,11 +122,11 @@ elsif !@core_fields[:acceptednameusageid] && @core_fields[:taxonomicstatus] && status_synonym?(r[@core_fields[:taxonomicstatus]]) add_synonym_from_core(parent_id, r) else taxon = @normalized_data[r[@core_fields[:id]]] ? @normalized_data[r[@core_fields[:id]]] : @normalized_data[r[@core_fields[:id]]] = DarwinCore::TaxonNormalized.new taxon.id = r[@core_fields[:id]] - taxon.current_name = r[@core_fields[:scientificname]] - taxon.current_name_canonical = r[@core_fields[:canonicalname]] + taxon.current_name = r[@core_fields[:scientificname]].force_encoding("utf-8") + taxon.current_name_canonical = r[@core_fields[:canonicalname]].force_encoding("utf-8") taxon.parent_id = r[parent_id] taxon.rank = r[@core_fields[:taxonrank]] if @core_fields[:taxonrank] taxon.status = r[@core_fields[:taxonomicstatus]] if @core_fields[:taxonomicstatus] add_name_string(taxon.current_name) add_name_string(taxon.current_name_canonical)