It's not taking advantage of the weird way python strings work. You can put that hack on top of any string format that converts back and forth with unicode.