[Master Bug 10656]   Generated CSV file cannot display Chinese characters in MS Excel

So much duplicated code, can you not use the "if CSV" branch here too?