Bug 1223 - cpp()'s EBCDIC autodetection code fails
: cpp()'s EBCDIC autodetection code fails
Status: RESOLVED FIXED
: Pike
Core
: 7.2
: All All
: P3 (normal) minor
: ---
Assigned To:
:
:
:
  Show dependency treegraph
 
Reported: 2001-02-23 13:32 CET by
Modified: 2001-03-26 18:53 CET (History)
Scrum Prio:
In scrum?: ---
Story included in sprints:
Unplanned in sprints:


Attachments


Description From 2001-02-23 13:32:09 CET
> string s = "#charset EBCDIC-US\nFoo Bar\n";
Result: "#charset EBCDIC-US\nFoo Bar\n"
> object enc = Locale.Charset.encoder("EBCDIC-US");
Result: object
> string e = enc->feed(s)->drain();
Result: "{\203\210\201\231╒\205ё@ебцдиц`ДБ\nф\226\226@б\201\231\n"
> cpp(e);
Result: "# 1
\"-\"\n{\203\210\201\231╒\205ё@ебцдиц`ДБ\nф\226\226@б\201\231\n"

Note the first line, which destroys the autodetection code...
------- Comment #1 From 2001-03-26 18:54:33 CET -------
Oops, apparently the auto-detect code is intentionally disabled in cpp() by
default:

> string s = "#charset EBCDIC-US\nFoo Bar\n";
Result: "#charset EBCDIC-US\nFoo Bar\n"
> object enc = Locale.Charset.encoder("EBCDIC-US");
Result: object
> string e = enc->feed(s)->drain();
Result: "{\203\210\201\231╒\205ё@ебцдиц`ДБ\nф\226\226@б\201\231\n"
> cpp(e, "-", 1);
Result: "# 1 \"-\"\n\nFoo Bar\n"

So the fix is just to change arg 3 to cpp() in compile_string().

Fixed in both Pike 7.2 and 7.3.

Note

You need to log in before you can comment on or make changes to this bug.