/ Check-in [dc5b1f0ba1]
DEMO | DOWNLOAD | DEPLOY | SEARCH
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Change format %c to not use utf, adding %C for utf.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:dc5b1f0ba112d66dfe735ca6376760e1e94836a8
User & Date: pmacdona 2019-08-11 00:49:14
Context
2019-08-23
04:29
Test check-in: c3073e09ce user: pmacdona tags: trunk
2019-08-11
00:49
Change format %c to not use utf, adding %C for utf. check-in: dc5b1f0ba1 user: pmacdona tags: trunk
2019-07-27
14:46
Fix erroneous error for String.fromCharCode. [33ca23183f] check-in: 576fa59f01 user: pmacdona tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/jsiFormat.c.

295
296
297
298
299
300
301

302
303
304
305
306
307
308
309
310

311




312
313
314
315
316
317
318
                Jsi_DSSetLength(&pStr, 0);
                formatted_bytes = formatted_chars = precision;
                formatted_buf = Jsi_DSAppendLen(&pStr, formatted_buf, precision);
                //formatted_bytes = Jsi_UtfIndexToOffset(formatted_buf, precision);
            }
            break;
        case 'c':

            v = Jsi_ValueArrayIndex(interp, args, argIndex);
            if ((formatted_buf = Jsi_ValueString(interp, v, &formatted_bytes))==NULL || formatted_bytes!=1) {
                Jsi_Wide code;
                if (!Jsi_ValueIsNumber(interp, v))
                    goto error;
                Jsi_GetWideFromValue(interp, v, &code);
                if (code<0 || code>255)
                    goto error;
                /* Just store the value in the 'spec' buffer */

                formatted_bytes = Jsi_UniCharToUtf(code, spec);




                formatted_buf = spec;
            }
            formatted_chars = 1;
            break;

        case 'a':
        case 'A':







>









>
|
>
>
>
>







295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
                Jsi_DSSetLength(&pStr, 0);
                formatted_bytes = formatted_chars = precision;
                formatted_buf = Jsi_DSAppendLen(&pStr, formatted_buf, precision);
                //formatted_bytes = Jsi_UtfIndexToOffset(formatted_buf, precision);
            }
            break;
        case 'c':
        case 'C':
            v = Jsi_ValueArrayIndex(interp, args, argIndex);
            if ((formatted_buf = Jsi_ValueString(interp, v, &formatted_bytes))==NULL || formatted_bytes!=1) {
                Jsi_Wide code;
                if (!Jsi_ValueIsNumber(interp, v))
                    goto error;
                Jsi_GetWideFromValue(interp, v, &code);
                if (code<0 || code>255)
                    goto error;
                /* Just store the value in the 'spec' buffer */
                if (ch == 'C')
                    formatted_bytes = Jsi_UniCharToUtf(code, spec);
                else {
                    snprintf(spec, sizeof(spec), "%c", (int)code);
                    formatted_bytes = 1;
                }
                formatted_buf = spec;
            }
            formatted_chars = 1;
            break;

        case 'a':
        case 'A':