PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ codepage2encoding()

char * codepage2encoding ( const char *  cpg)

Definition at line 302 of file shpcommon.c.

303{
304 int cpglen;
305 int is_ldid = 0;
306 int num, i;
307
308 /* Do nothing on nothing. */
309 if ( ! cpg ) return NULL;
310
311 /* Is this an LDID string? */
312 /* If so, note it and move past the "LDID/" tag */
313 cpglen = strlen(cpg);
314 if ( strstr(cpg, "LDID/") )
315 {
316 if ( cpglen > 5 )
317 {
318 cpg += 5;
319 is_ldid = 1;
320 }
321 else
322 {
323 return NULL;
324 }
325 }
326
327 /* Read the number */
328 num = atoi(cpg);
329
330 /* Can we find this number in our lookup table? */
331 for ( i = is_ldid ; i < num_code_pages; i++ )
332 {
333 if ( is_ldid )
334 {
335 if ( code_pages[i].ldid == num )
336 return strdup(code_pages[i].iconv);
337 }
338 else
339 {
340 if ( code_pages[i].cpg == num )
341 return strdup(code_pages[i].iconv);
342 }
343 }
344
345 /* Didn't find a matching entry */
346 return NULL;
347
348}
static int num_code_pages
Definition shpcommon.c:35
static code_page_entry code_pages[]
Definition shpcommon.c:40

References code_pages, and num_code_pages.

Referenced by ShpLoaderOpenShape().

Here is the caller graph for this function: