PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ encoding2codepage()

char* encoding2codepage ( const char *  encoding)

Definition at line 343 of file shpcommon.c.

References num_code_pages.

Referenced by ShpDumperOpenTable().

344 {
345  int i;
346  for ( i = 0; i < num_code_pages; i++ )
347  {
348  if ( strcasecmp(encoding, code_pages[i].pg) == 0 )
349  {
350  if ( code_pages[i].ldid == 0xFF )
351  {
352  return strdup("UTF-8");
353  }
354  else
355  {
356  char *codepage = NULL;
357  int ret = asprintf(&codepage, "LDID/%d", code_pages[i].ldid);
358  if ( ret == -1 ) return NULL; /* return null on error */
359  return codepage;
360  }
361  }
362  }
363 
364  /* OK, we give up, pretend it's UTF8 */
365  return strdup("UTF-8");
366 }
static code_page_entry code_pages[]
Definition: shpcommon.c:36
static int num_code_pages
Definition: shpcommon.c:31
Here is the caller graph for this function: