Split unicode string into 300 byte chunks without destroying characters

I want to split u"an arbitrary unicode string" into chunks of say 300 bytes without destroying any characters. The strings will be written to a socket that expects utf8 using unicode_string.encode("utf8"). I don't want to destroy any characters. How would I do this?

9
задан runfalk 18 May 2011 в 10:48
поделиться