sosedoff / xml-sitemap

Easy XML sitemap generation for Ruby/Rails/Merb/Sinatra applications
MIT License
57 stars 19 forks source link

Use binary mode to write encoded files #17

Closed saulius closed 11 years ago

saulius commented 11 years ago

Hi there,

I got this error while trying to use xml-sitemap with gzip enabled: Encoding::UndefinedConversionError: "\x8B" from ASCII-8BIT to UTF-8

This looks like similar issue description http://stackoverflow.com/questions/13909812/error-ruby-on-rails-encodingundefinedconversionerror-in-coursescontrollerat

Opening file for writing in binary mode fixes this. I tried to use it blank sitemap, just xml instruction and urlset with namespaces. Unfortunately I couldn't reproduce this in spec. Hope it helps anyway.