[plt-scheme] efficiently converting from foo to Latin-1-safe for storage in strings

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Sun Jan 4 11:25:03 EST 2009

Let's say that most of my system is using UTF-8, but there is one part 
that is not yet.

Until that part can be reworked, I want to make sure that all 
user-supplied strings (which are read from a port in character encoding 
"foo") have been converted to Latin-1, with any non-Latin-1 characters 
replaced with question-marks.

These converted Latin-1-safe string values are stored in Scheme strings.

What's an efficient way to do this?  Plug multiple "reencode-input-port" 
together, to convert from "foo" to Latin-1 to UTF-8?

Thanks.



Posted on the users mailing list.