dicom / ruby-dicom

Library for reading, editing and writing DICOM files, as well as handling DICOM network communication. Written in the Ruby language.
http://dicom.rubyforge.org/
GNU General Public License v3.0
178 stars 67 forks source link

UTF-8 encoding in dictionary.txt #40

Closed jeffmax closed 11 years ago

jeffmax commented 11 years ago

There are some non-ascii characters in dictionary text (0018,1153 Exposure in µAs IS 1). This is causing an error for me in ruby 1.9.2. This specifies the encoding as the file is read.

dicom commented 11 years ago

Looks reasonable. I wonder though, why I haven't seen this before, even on ruby 1.9.2. Could you give me a failing spec example?

dicom commented 11 years ago

Turns out I should actually check things out before I open my mouth. When actually executing the spec on my 1.9.2 version I actually had some failures. However, I think they were unrelated to this issue, and they have been fixed in the current master branch.

I would still love to see how this fails though, so we can add a spec example and prevent future regressions.

jeffmax commented 11 years ago

Chris,

I am trying to recreate this, but as of right now I can only make it happen when I am running inside of a Rack application. I have no idea why this would be the case, but the traceback is:

invalid byte sequence in US-ASCII 0 /home/vagrant/.rvm/gems/ruby-1.9.2-p320/gems/dicom-0.9.4/lib/dicom/d_library.rb 209 in split' 1 /home/vagrant/.rvm/gems/ruby-1.9.2-p320/gems/dicom-0.9.4/lib/dicom/d_library.rb 209 inload_element' 2 /home/vagrant/.rvm/gems/ruby-1.9.2-p320/gems/dicom-0.9.4/lib/dicom/d_library.rb 28 in block in initialize' 3 /home/vagrant/.rvm/gems/ruby-1.9.2-p320/gems/dicom-0.9.4/lib/dicom/d_library.rb 27 ineach' 4 /home/vagrant/.rvm/gems/ruby-1.9.2-p320/gems/dicom-0.9.4/lib/dicom/d_library.rb 27 in initialize' 5 /home/vagrant/.rvm/gems/ruby-1.9.2-p320/gems/dicom-0.9.4/lib/dicom/constants.rb 118 innew' 6 /home/vagrant/.rvm/gems/ruby-1.9.2-p320/gems/dicom-0.9.4/lib/dicom/constants.rb 118 in ' 7 /home/vagrant/.rvm/gems/ruby-1.9.2-p320/gems/dicom-0.9.4/lib/dicom/constants.rb 1 in' 8 /home/vagrant/.rvm/gems/ruby-1.9.2-p320/gems/dicom-0.9.4/lib/dicom.rb 43 in `require_relative' 9 /home/vagrant/.rvm/gems/ruby-1.9.2-p320/gems/dicom-0.9.4/lib/dicom.rb

I will continue to look into this.

Jeff

dicom commented 11 years ago

Merged. Thanks for the contribution!