[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 20010823: using attribute containing wide characters



>From: catherine Fontaine <address@hidden>
>Subject: using attribute containing wide characters 
>Organization: ?
>Keywords: 200108231017.f7NAHq116867 netCDF Matlab

Hi,

> I use the NETCDF toolbox for Matlab 5/6 and I would like to store wide
> characters and I can't.
> How could I do this please

I'm sorry to say you will have to encode them as 16-bit or 32-bit
integers (netCDF types NC_SHORT or NC_INT for C or the corresponding
Fortran types).  There is still no support for wide characters or for
Unicode in netCDF.  In 1988 when the format was created, we assumed
that a character required only 8 bits.  Changing that assumption now
would require a change to the netCDF format, which would be very
disruptive.

But an attribute may contain a vector of 16-bit shorts or 32-bit ints,
though this is not as convenient as just using strings.

An alternative would be to use some standard encoding for wide
characters into 8-bit characters, such as UTF-8 which uses 1, 2, or 3
bytes for each Unicode character.

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu