This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
>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