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

[netCDF #YVO-179076]: NetCDF / nc_open / c++



> Could it be that for "nc_open" the Coding must be changed within the code ?
Yes. There is probably a way to tell the visual studio compiler to use
utf-8 for all strings in the program, although I do not know what it is.

> 
> i did some further invetsigations on it and found the following.
> 
> In my example, the german Umlaut "ä" and "ö" are used.
> 
> Once the system uses "ISO8859-1", they were represented as "ä" and "ö"
> as shown in the list.
> 
> Could it be that for "nc_open" the Coding must be changed within the code ?
> 
> Thks
> 
> Thomas
> 
> 
> 
> -------- Weitergeleitete Nachricht --------
> Betreff:      Re: [netCDF #YVO-179076]: NetCDF / nc_open / c++
> Datum:        Thu, 26 Apr 2018 08:37:02 +0200
> Von:  Thomas Wälde-Nuber <address@hidden>
> An:   address@hidden
> 
> 
> 
> Hello,
> 
> thks for your help.
> 
> Within the MS-routine "widechartomultibyte",  i use the given "CP_UTF8".
> 
> Within attached file you can seee zhe hexadecimal representation of the
> characters.
> 
> Thks again
> 
> Thomas
> 
> 
> Am 25.04.2018 um 23:33 schrieb Unidata netCDF Support:
> > We rely on various publically available libraries for our
> > utf-8 management (translation, normalizations, etc).
> >
> > It does look like microsoft code is incorrectly treating you example
> > string, but I am not sure why. Is it possible to print out the two
> > file paths as bytes, that is in the format 0xab, 0xff,...?
> > That may give us a hint about what is going wrong.
> >
> > One more thing, are you telling MS to use the correct encoding, i.e. UTF-8,
> > instead of, say, ISO-LATIN1?
> >
> >> thks for answer.
> >>
> >> Yes, i'm using VS2015.
> >>
> >> Belwo you find the UniCode-String to be used (here with german Umlaut
> >>
> >>      L"D:\\Testumgebung\\Import\\liquid  äÜö.CDF"
> >>
> >> and then the converted UTF-8 by Microsoft:
> >>
> >>      "D:\\Testumgebung\\Import\\liquid  äÜö.CDF"
> >>
> >> Maybe this Conversion is not the one needed.
> >>
> >> Please, are there any example for converting Unicode to UTF-8 by Unidata
> >> and vice versa ?
> >>
> >>
> >> Thks a lot in advance
> >>
> >> Thomas
> >>
> >>
> >> Am 23.04.2018 um 19:03 schrieb Unidata netCDF Support:
> >>> 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.
> >>>
> >>>
> >>>
> >>
> > =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.
> >
> >
> >
> 
> 
> 
> 

=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.