UTF-8 or Default Unicode - Which one should be taken

  • Thread starter Thread starter Jazper
  • Start date Start date
J

Jazper

hi

i'd like to save a textfile within my program.
i read that ascii or ansi not should be taken anymore for storing textdata
to a file. people should take unicode encoding.
so with .net i can easely use...

System.Text.Encoding.Unicode
or
System.Text.Encoding.UTF-8

so which one should i take to be up to date? Unicode or UTF-8?

cheers, jazper
 
Jazper said:
i'd like to save a textfile within my program.
i read that ascii or ansi not should be taken anymore for storing textdata
to a file. people should take unicode encoding.
so with .net i can easely use...

System.Text.Encoding.Unicode
or
System.Text.Encoding.UTF-8

so which one should i take to be up to date? Unicode or UTF-8?

You can use either. Both encode the same range of values. UTF-8 is more
compact if you've got a lot of ASCII text in your data, and Unicode is
more compact if you've got a lot of far East characters. Unicode might
also be simpler in some ways as it's a fixed width encoding (i.e. you
know that 1000 bytes is 500 characters - in UTF-8 it could be anything
from 250 to 1000 characters.)

Personally I prefer UTF-8 in most circumstances, but it does depend on
exactly what you want to do.
 
Back
Top