chucknorris / warmup

WarmuP - a simple templater / token replacement tool
44 stars 24 forks source link

Including the Byte Order Mark (BOM)/Preamble for yml files breaks Ruby yml parsing #8

Closed amirrajan closed 12 years ago

amirrajan commented 12 years ago

TL;DR: Only add the UTF8 BOM/Preamble to .sln files. Or only add the BOM to those files that originally contained it.

If you WarmuP a template that contains a .yml file, this line adds the Byte Order Mark/Preamble for UTF8: https://github.com/chucknorris/warmup/blob/master/warmup/TargetDir.cs#L82

The WriteAllText method that is currently being used writes the BOM as the first byte in the file.

Ruby's core yml library reads the BOM as part of the key (the yml is read..but the hash created contains the BOM...not so great...rails applications uses config.yml...it breaks stuff to say the least...)

Also, based on this StackOverflow answer, it is apparently not a good thing to add the BOM to xml files: http://stackoverflow.com/questions/1317700/strip-byte-order-mark-from-string-in-c-sharp

The BOM is unfortunately required for .sln files so that VSSelector can open the solution and not crash.

amirrajan commented 12 years ago

Read some more on the issue....torn on what can be done about it:

http://broadcastingadam.com/2011/10/dear_god_what_is_this_bug

ferventcoder commented 12 years ago

Dupe of https://github.com/chucknorris/warmup/issues/7

ferventcoder commented 12 years ago

You elaborated quite a bit more, so I think we'll keep yours open and close mine.

amirrajan commented 12 years ago

pull request for bug fix: https://github.com/chucknorris/warmup/pull/9