TDPL: Foreach over Unicode string

Sean Kelly sean at invisibleduck.org
Tue Jul 27 15:34:40 PDT 2010


Sean Kelly Wrote:
> 
> I think it's Windows integration that's the problem, on OSX I get:
> 
> [H][a][l][l][?][?][,][ ][V][?][?][r][l][d][!]
> [H][a][l][l][å][,][ ][V][ä][r][l][d][!]
> 
> which is essentially correct.  The only difference between this and doing the same thing in C and using printf() in place of write() is that both lines display correctly in C.  I think printf() must be detecting partial UTF-8 characters and buffering until the complete chunk has arrived.  Interestingly, the C output can't even be broken by badly timed calls to fflush(), so the buffering is happening at a fairly high level.  I'd be interested in seeing the same thing in write() at some point.

Ah, write() already works that way.  It was the brackets that were screwing things up.


More information about the Digitalmars-d mailing list