[mercury-users] Advice with UNICODE string type

Luke Evans Luke.Evans at seagatesoftware.com
Thu Jul 15 11:38:53 AEST 1999

Hello all,

I need a little advice about the best way to represent a UNICODE (wide)
string type in Mercury.  The constraints are as follows:
- The wstring type should be fairly easy to construct from Mercury strings
(though a function would be fine)
- The wstring type should transfer across the Mercury-C interface simply.
If would be nice if C would see it as a true UNICODE string, though I'd be
happy with a little massaging on the C side too.

This whole requirement comes about because we aggressively localise all our
products and all our new technologies have pure UNICODE interfaces.  I
really don't care about having UNICODE in Mercury at the moment.  I _could_
write C wrappers around the UNICODE C functions and promote all the 8 bit
strings to UNICODE16 completely in the C world (and demote going the other
way of course).  However, assuming I didn't want to do this (and wanted a
Mercury wide character/string type), what would be the best approach?

I started naively with a list of ints, but I'm not too happy with this.

I suspect, that if I wanted to do this properly (i.e. localise the Mercury
code too), and Mercury was not likely to get real wide character/string
types in the near future, I would use UTF-8 on the Mercury side and write
UTF/UNICODE translation into wrappers on the C side. 

Any suggestions/comments greatly appreciated.

mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe

More information about the users mailing list