Yeah (sheepish) I was a little confused about what does the return in the template system when I wrote the original post. All you have to do is tweak template::get_mime_type and you're done with the templated pages I think.
For other pages, yes a wrapper for ns_return sounds like a good idea to me. It looks like the ns_return is written in C not tcl, and I don't know what all you do to intercept it and then call it. For Planet, a simple hack to doc_return should suffice for what we need:
ad_proc -public doc_return {args} {
Replaces acs doc_return: modified to use locale-specific charset.
@ author Alex Sokolofff (alex_sokoloff@yahoo.com)
} {
db_release_unused_handles
# strip out any charset information included
regsub -all {; charset=(.+)} [lindex $args 1] "" mimetype
# add charset specified by gp-lang
set mimetype "${mimetype}; charset=[gp_determine_charset]"
set args [lreplace $args 1 1 $mimetype]
eval "ns_return $args"
}
Again, most of the pages here and there in the system that will be returned with ns_return or one of its variants are hard-coded in English at this point, so it wouldn't really make sense to return them with a shift-js charset even on a japanese portion of a site. So maybe there isn't much of a problem here after all!