comparison src/c/urweb.c @ 1857:79c0c22e13ae

Postgres unicode printing fix from Artyom Shalkhakov
author Adam Chlipala <adam@chlipala.net>
date Wed, 17 Jul 2013 09:09:48 -0400
parents 690638bd9fef
children 9fc086e3c95a
comparison
equal deleted inserted replaced
1856:3683d1a8c1c8 1857:79c0c22e13ae
2449 break; 2449 break;
2450 default: 2450 default:
2451 if (isprint((int)c)) 2451 if (isprint((int)c))
2452 *s2++ = c; 2452 *s2++ = c;
2453 else if (uw_Estrings) { 2453 else if (uw_Estrings) {
2454 sprintf(s2, "\\%03o", c); 2454 sprintf(s2, "\\%03o", (unsigned char)c);
2455 s2 += 4; 2455 s2 += 4;
2456 } 2456 }
2457 else 2457 else
2458 *s2++ = c; // I hope this is safe to do... don't know how to support UTF-8 outside Postgres otherwise! 2458 *s2++ = c; // I hope this is safe to do... don't know how to support UTF-8 outside Postgres otherwise!
2459 } 2459 }
2492 break; 2492 break;
2493 default: 2493 default:
2494 if (isprint((int)c)) 2494 if (isprint((int)c))
2495 *s2++ = c; 2495 *s2++ = c;
2496 else if (uw_Estrings) { 2496 else if (uw_Estrings) {
2497 sprintf(s2, "\\%03o", c); 2497 sprintf(s2, "\\%03o", (unsigned char)c);
2498 s2 += 4; 2498 s2 += 4;
2499 } 2499 }
2500 else 2500 else
2501 uw_error(ctx, FATAL, "Non-printable character %u in char to SQLify", c); 2501 uw_error(ctx, FATAL, "Non-printable character %u in char to SQLify", c);
2502 } 2502 }