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

◆ codepage2encoding()

char * codepage2encoding ( const char *  cpg)

Definition at line 288 of file shpcommon.c.

289{
290 int cpglen;
291 int is_ldid = 0;
292 int num, i;
293
294 /* Do nothing on nothing. */
295 if ( ! cpg ) return NULL;
296
297 /* Is this an LDID string? */
298 /* If so, note it and move past the "LDID/" tag */
299 cpglen = strlen(cpg);
300 if ( strstr(cpg, "LDID/") )
301 {
302 if ( cpglen > 5 )
303 {
304 cpg += 5;
305 is_ldid = 1;
306 }
307 else
308 {
309 return NULL;
310 }
311 }
312
313 /* Read the number */
314 num = atoi(cpg);
315
316 /* Can we find this number in our lookup table? */
317 for ( i = is_ldid ; i < num_code_pages; i++ )
318 {
319 if ( is_ldid )
320 {
321 if ( code_pages[i].ldid == num )
322 return strdup(code_pages[i].iconv);
323 }
324 else
325 {
326 if ( code_pages[i].cpg == num )
327 return strdup(code_pages[i].iconv);
328 }
329 }
330
331 /* Didn't find a matching entry */
332 return NULL;
333
334}
static int num_code_pages
Definition shpcommon.c:31
static code_page_entry code_pages[]
Definition shpcommon.c:36

References code_pages, and num_code_pages.

Referenced by ShpLoaderOpenShape().

Here is the caller graph for this function: