Re: [racket] Writing UTF-16 to a socket/file

2011-02-12 Thread Sam Tobin-Hochstadt
On Sat, Feb 12, 2011 at 2:35 PM, Gregory Woodhouse wrote: > Is it possible to ensure that data written to a socket or file is encoded as > UTF-16? I ask because Health Level 7 (HL7) 2.5.1 allows messages to use > UTF-16 as opposed to US-ASCII, but it has to be a fixed width encoding. Note that

Re: [racket] Writing UTF-16 to a socket/file

2011-02-12 Thread Gregory Woodhouse
Thanks, everyone. This is just what I was looking for. Sent from my iPad On Feb 12, 2011, at 4:53 PM, Robby Findler wrote: > Oh, yes, that looks right to me. > > Robby > > On Sat, Feb 12, 2011 at 2:54 PM, Neil Van Dyke wrote: >> Won't "reencode-output-port" let you write Racket strings as U

Re: [racket] Writing UTF-16 to a socket/file

2011-02-12 Thread Robby Findler
Oh, yes, that looks right to me. Robby On Sat, Feb 12, 2011 at 2:54 PM, Neil Van Dyke wrote: > Won't "reencode-output-port" let you write Racket strings as UTF-16 > transparently? > > >> On Sat, Feb 12, 2011 at 2:35 PM, Gregory Woodhouse >> wrote: >> >>> >>> Is it possible to ensure that data w

Re: [racket] Writing UTF-16 to a socket/file

2011-02-12 Thread Neil Van Dyke
Won't "reencode-output-port" let you write Racket strings as UTF-16 transparently? On Sat, Feb 12, 2011 at 2:35 PM, Gregory Woodhouse wrote: Is it possible to ensure that data written to a socket or file is encoded as UTF-16? I ask because Health Level 7 (HL7) 2.5.1 allows messages to us

Re: [racket] Writing UTF-16 to a socket/file

2011-02-12 Thread Chongkai Zhu
You can use string->utf16 from rnrs/bytevectors-6: (require rnrs/bytevectors-6) (string->utf16 "abc") and them use "write-bytes". Chongkai On 2/12/2011 2:35 PM, Gregory Woodhouse wrote: Is it possible to ensure that data written to a socket or file is encoded as UTF-16? I ask because Healt

Re: [racket] Writing UTF-16 to a socket/file

2011-02-12 Thread Robby Findler
You can work at the bytes level when you communicate on the port and use converters to turn the bytes into strings when you want to actually do things like match regexps or examine characters or similar. Robby On Sat, Feb 12, 2011 at 2:35 PM, Gregory Woodhouse wrote: > Is it possible to ensure t

[racket] Writing UTF-16 to a socket/file

2011-02-12 Thread Gregory Woodhouse
Is it possible to ensure that data written to a socket or file is encoded as UTF-16? I ask because Health Level 7 (HL7) 2.5.1 allows messages to use UTF-16 as opposed to US-ASCII, but it has to be a fixed width encoding. _ For list-related adminis