Add specs for the external and internal encodings of IO.popen
Don't set IO.popen's internal encoding if it's the same as the external

Fixes #2427
Write specs for StopIteration#result
Implement StopIteration#result