Make CarbonCopy a better replacement for sys.stdout
sys.stdout has encoding attribute.
This PR will be useful for my next PR to Invoke.
Thanks :) couple quick thoughts w/o actually testing anything yet:
- Do we need to change
getvalue()as well? It was the other spot that hardcoded'utf-8'encoding stuff. - Will this break anything that used to rely on the implicit
utf-8encoding? Feels like the naïve case would end up being encoded aslatin-1now instead ofutf-8. (This is hopefully ignorant paranoia on my part, but presumably I choseutf-8earlier for a reason, instead oflatin-1.)
I have just fixed getvalue.
I guess it shouldn't break anything if cc'ing streams have encoding attribute.
@bitprophet Is there anything to improve in this PR?
Nope, thanks. I just have too many projects (with too many users each :D) and too little time. Not everything's gonna be quick :(
Assuming this is required for one of the encoding tests in Invoke to work correctly, I'll doubtless merge this as a dependency of the other, whenever it's gotten to.
@bitprophet It used to be needed in my Invoke patch, but then I changed the logic around encoding, so it is not required at the moment. Nevertheless, it is good improvement anyway.
Gotcha, good to know, thanks (& I agree, more encoding control is usually better :))