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.
You appear to be running under windows visual studio, correct? The first thing I would do is to either print out the converted name, or using the VS debugger, look at the utf8 bytes and see if they match the name of the file you are trying to open. > > > pls, i hope you can help me. > > I'm trying to open NetCDF- Files using nc_open. > > Filenames are of type "wchar_t", so i have to translate them to UTF-8. > > Pls, ref to source below > > ========== > > int size_needed = WideCharToMultiByte(CP_UTF8, 0, g_cOpen, -1, > NULL, 0, NULL, NULL); > char *opener = new char[size_needed]; > WideCharToMultiByte(CP_UTF8, 0, g_cOpen, -1, &opener[0], > size_needed, NULL, NULL); > > ret2=nc_open(opener,NC_NOWRITE,&ncid); > > =========== > > Once, the filename and/or path includes "Non-ASCII"- signs, nc_open > returns 2 (can not find file) > > or 3 (canot find path). > > Is nc_open able to handle UTF8 ? > > Thks in advance > > Thomas Wälde-Nuber > > > =Dennis Heimbigner Unidata Ticket Details =================== Ticket ID: YVO-179076 Department: Support netCDF Priority: Normal Status: Open =================== NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.