The R Project SVN R

Rev

Rev 52419 | Rev 52814 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 52419 Rev 52804
Line 320... Line 320...
320
    }
320
    }
321
    if (fgets(buf, len, ifp ? ifp : stdin) == NULL) return 0;
321
    if (fgets(buf, len, ifp ? ifp : stdin) == NULL) return 0;
322
    /* translate if necessary */
322
    /* translate if necessary */
323
    if(strlen(R_StdinEnc) && strcmp(R_StdinEnc, "native.enc")) {
323
    if(strlen(R_StdinEnc) && strcmp(R_StdinEnc, "native.enc")) {
324
	size_t res, inb = strlen(buf), onb = len;
324
	size_t res, inb = strlen(buf), onb = len;
325
	const char *ib = buf; char *ob, *obuf;
325
	const char *ib = buf; 
326
	ob = obuf = alloca(len+1);
326
	char obuf[len+1], *ob = obuf;
327
	if(!cd) {
327
	if(!cd) {
328
	    cd = Riconv_open("", R_StdinEnc);
328
	    cd = Riconv_open("", R_StdinEnc);
329
	    if(!cd) error(_("encoding '%s' is not recognised"), R_StdinEnc);
329
	    if(!cd) error(_("encoding '%s' is not recognised"), R_StdinEnc);
330
	}
330
	}
331
	res = Riconv(cd, &ib, &inb, &ob, &onb);
331
	res = Riconv(cd, &ib, &inb, &ob, &onb);