1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  # prepare notes
  notes = entry[45]
  # delete crap at start
  index = notes.index('\\fs16 ')
  notes = notes[index+6..-1] if !index.nil?
  # replace new lines
  notes = notes.gsub('\\\\par\r\n', "\n")
  # delete end
  notes = notes.gsub("\n}\\r\\n\\0", "")
  notes = notes.gsub('\\\\f1', "")
  notes = notes.strip
  # replace Euro Symbol
  notes = notes.gsub "\\\\\\'80", "€"
  
  # replace umlauts
  hits = []
  notes.to_enum(:scan,/\\\\\\'/).map do |m,|
    hits << $`.size
  end
  
  hits.each do |pos|
    rep = notes[pos+4..pos+5] # returns fc f6 e4 ...
    rep = rep.hex.chr(Encoding::UTF_8)
    notes[pos..pos+5] = "|||||"+rep
  end
  
  notes = notes.gsub "|||||", ""