How do you encode a png image into base64 using python on Windows?

iconfile = open("icon.png")
icondata = iconfile.read()
icondata = base64.b64encode(icondata)

The above works fine in Linux and OSX, but on Windows it will encode the first few characters then cut short. Why is this?

Edit
Report