This project is read-only.
2

Closed

File encoding is not the same as EncodingType

description

The generated file is in ANSII and not in encoding define in EncodingType.
 
I think you could add _encoding to File.WriteAllText on CompressorTask.cs line 428

file attachments

Closed Jan 17, 2011 at 1:54 AM by purekrome

comments

purekrome wrote Dec 9, 2009 at 11:36 AM

Hi lcalvy,

can you please tell me how you can check to see the what type of encoding the generated file is? this way, i can test it when i bug fix this.

cheers mate :)

wrote Jun 7, 2010 at 1:13 AM

wrote Oct 29, 2010 at 2:08 PM

BenjaminBaumann wrote Oct 29, 2010 at 3:56 PM

It's hard to check a file's encoding type. The easier way I know is to open the file with Notepad++ and to see what encoding is selected. For most encoding (UTF8, Unicode BigEndian ...) the encoding type is given by the bom (the first 4 bytes of the file).
Like it was reported by lcalvy,
File.WriteAllText(destinationFileName,
                              compressedText == null ? string.Empty : compressedText.ToString(),_encoding);
do the trick.

wrote Nov 9, 2010 at 9:38 AM

BenjaminBaumann wrote Nov 9, 2010 at 9:38 AM

Here is my CompressorTask.cs file. The modifications are the following :
  • Write the file using the specified encoding
  • New value for encoding : keep/keepencoding/pinte. Use the encoding of the first file for reading and writing.
These modifications are in prod for two weeks and we have no problem with them.

BenjaminBaumann wrote Nov 9, 2010 at 9:39 AM

I forgot to mention that this was for the Model project, I did not change the .net 2.0 project.

wrote Jan 6, 2011 at 3:48 AM

purekrome wrote Jan 6, 2011 at 3:55 AM

Ok. Code updated. Not sure how to really test it (with Unit Tests) though :( When the next build comes out, hopefully you can check/confirm that this is now fixed, guys :)

wrote Jan 6, 2011 at 5:24 AM

wrote Jan 17, 2011 at 1:54 AM

wrote Feb 22, 2013 at 12:55 AM

wrote May 16, 2013 at 12:20 PM