follow encoding directives

This commit is contained in:
Vítor Santos Costa 2016-02-22 12:57:46 +00:00
parent df7feea0aa
commit 588ef40a16
2 changed files with 4 additions and 1 deletions

View File

@ -190,6 +190,7 @@ static bool is_file_errors(Term t) {
void Yap_DefaultStreamOps(StreamDesc *st) {
st->stream_wputc = put_wchar;
st->stream_wgetc = get_wchar;
if (st->status & (Promptable_Stream_f)) {
st->stream_wgetc = get_wchar;
Yap_ConsoleOps(st, true);
@ -1354,6 +1355,7 @@ int PlGetc(int sno) {
st->encoding = enc_id( s_encoding, st->encoding);
else
st->encoding = encoding;
Yap_DefaultStreamOps( st);
if (script)
open_header(sno, open_mode);

View File

@ -790,7 +790,8 @@ static bool do_set_stream(int sno,
Atom atEnc = AtomOfTerm(t2);
GLOBAL_Stream[sno].encoding =
enc_id(atEnc->StrOfAE, (GLOBAL_Stream[sno].status & HAS_BOM_f ? GLOBAL_Stream[sno].encoding :ENC_OCTET ) );
}
Yap_DefaultStreamOps( GLOBAL_Stream+sno);
}
break;
case SET_STREAM_EOF_ACTION: {
Term t2 = args[SET_STREAM_EOF_ACTION].tvalue;