Welcome to Web-News
A Web-based News Reader
Subject Re: Transcoding - who's doing what?
From Ben Hinkle <bhinkle4@juno.com>
Date Tue, 17 Aug 2004 08:35:25 -0400
Newsgroups digitalmars.D


> (3) /This is most important/. In the typical scenario, the caller will be
> reading bytes from some source - which /could/ be a stream - and will want
> to get a single dchar. We're talking about a "get the next Unicode
> character" function, which is about as low level as it gets (in terms of
> functionality). But you can't build such a function out of your string
> routines, because you have no way of knowing in advance how many bytes
> will need to be consumed from the stream in order to build one character.
> So what do you do? Read too many and then put some back? Not all byte
> sources will allow you to "put back" or "unconsume" bytes.

std.stream supports ungetc, which pushes a character back by maintaining an
array of pushed-back characters. Right now only the text functions check
this array for content, though. I think the idea was that if one is storing
text and binary data mixed together that the text are stored with
writeString which puts a length byte followed by the text.

Recent messages in this thread
 
-# Transcoding - who's doing what? Arcane Jill 15-Aug-2004 04:15 pm
.-# Re: Transcoding - who's doing what? Ben Hinkle 15-Aug-2004 04:20 pm
.|\# Re: Transcoding - who's doing what? Arcane Jill 15-Aug-2004 07:20 pm
.-# Re: Transcoding - who's doing what? antiAlias 15-Aug-2004 04:58 pm
.|-# Re: Transcoding - who's doing what? Arcane Jill 15-Aug-2004 07:31 pm
.|.\# Re: Transcoding - who's doing what? antiAlias 15-Aug-2004 08:16 pm
.-# Re: Transcoding - who's doing what? teqDruid 15-Aug-2004 05:19 pm
.|-# Re: Transcoding - who's doing what? Arcane Jill 15-Aug-2004 07:34 pm
.|.-# Re: Transcoding - who's doing what? antiAlias 15-Aug-2004 08:12 pm
.|..-# Re: Transcoding - who's doing what? Nick 15-Aug-2004 10:59 pm
.|..|-# Re: Transcoding - who's doing what? Arcane Jill 16-Aug-2004 05:39 am
.|..|.\# Re: Transcoding - who's doing what? Nick 16-Aug-2004 08:51 am
.|..-# Re: Transcoding - who's doing what? teqDruid 16-Aug-2004 02:29 am
.|..|-# Re: Transcoding - who's doing what? Arcane Jill 16-Aug-2004 09:29 am
.|..|.\# Re: Transcoding - who's doing what? Martin M. Pedersen 16-Aug-2004 04:37 pm
.|..-# Re: Transcoding - who's doing what? Arcane Jill 16-Aug-2004 05:34 am
.|...-# Re: Transcoding - who's doing what? teqDruid 16-Aug-2004 02:58 pm
.|...|\# Re: Transcoding - who's doing what? Arcane Jill 17-Aug-2004 03:17 am
.|...-# Re: Transcoding - who's doing what? antiAlias 16-Aug-2004 03:14 pm
.|...||# Re: Transcoding - who's doing what? antiAlias 16-Aug-2004 03:41 pm
.|...|\# Re: Transcoding - who's doing what? Arcane Jill 17-Aug-2004 06:13 am
.|...-# Re: Transcoding - who's doing what? (Current message) Ben Hinkle 17-Aug-2004 08:35 am
.|....\# Re: Transcoding - who's doing what? Sean Kelly 17-Aug-2004 01:19 pm
.|# Re: Transcoding - who's doing what? Walter 16-Aug-2004 02:08 am
.-# Re: Transcoding - who's doing what? Sean Kelly 16-Aug-2004 06:20 pm
..-# Re: Transcoding - who's doing what? Arcane Jill 17-Aug-2004 03:40 am
...|# Re: Transcoding - who's doing what? antiAlias 17-Aug-2004 05:39 am
...|# Re: Transcoding - who's doing what? stonecobra 17-Aug-2004 12:06 pm
...\# Re: Transcoding - who's doing what? Sean Kelly 17-Aug-2004 01:11 pm