Re: Reading unicode chars..

2014-09-02 Thread Andrew Godfrey via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 14:06:04 UTC, seany wrote: How do I read unicode chars that has code points \u1FFF and higher from a file? file.getcw() reads only part of the char, and D identifies this character as an array of three or four characters. Importing std.uni does not change the

Re: Reading unicode chars..

2014-09-02 Thread Ali Çehreli via Digitalmars-d-learn
On 09/02/2014 07:06 AM, seany wrote: How do I read unicode chars that has code points \u1FFF and higher from a file? file.getcw() reads only part of the char, and D identifies this character as an array of three or four characters. Importing std.uni does not change the behavior. Thank you. O

Re: Reading unicode chars..

2014-09-02 Thread monarch_dodra via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 17:10:57 UTC, Ali Çehreli wrote: 1) To avoid a common gotcha, note that 'line' is reused at every iteration here. You must make copies of portions of it if you need to. Ali I don't know if you are aware, but "byLineCopy" was recently introduced. It will be av

Re: Reading unicode chars..

2014-09-02 Thread seany via Digitalmars-d-learn
Hi Ali, i know this example from your book. But try to capture „ the low quotation mark, appearing in the All-purpose punctuations plane of unicode, with \u201e - I worte I am having problems with \u1FFF and up. This particular symbol, is seen as a dchar array "\x1e\x20" - so two dchars, usi

Re: Reading unicode chars..

2014-09-02 Thread seany via Digitalmars-d-learn
Linux 64 bit, D2, phobos only.

Re: Reading unicode chars..

2014-09-02 Thread Ali Çehreli via Digitalmars-d-learn
On 09/02/2014 11:11 AM, seany wrote: > But try to capture „ the low quotation mark, appearing in the > All-purpose punctuations plane of unicode, with \u201e - I worte I am > having problems with \u1FFF and up. You are doing it differently. Can you show us a minimal example? Otherwise, there is

Re: Reading unicode chars..

2014-09-02 Thread seany via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 18:22:54 UTC, Ali Çehreli wrote: That would happen when you you treat the chars on the input and individual dchars. That is precisely where the problem is. If you use the character in a file, and then open it as a stream, then use File.getc() or file.getcw(

Re: Reading unicode chars..

2014-09-02 Thread seany via Digitalmars-d-learn
Your example reads the file by lines, i need to get them by chars.

Re: Reading unicode chars..

2014-09-02 Thread monarch_dodra via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 18:30:55 UTC, seany wrote: Your example reads the file by lines, i need to get them by chars. If you are intent on reading the stream character (or wcharacter) 1 by 1, then you will have to decode them manually, as there is no "getcd". Unfortunately, the "new

Re: Reading unicode chars..

2014-09-02 Thread Ali Çehreli via Digitalmars-d-learn
On 09/02/2014 02:13 PM, monarch_dodra wrote: > I'd suggest you create a range out of your std.stream.File, which reads > it byte by byte. I was in the process of doing just that. > Then, you pass it to the "byDchar()" range, which will > auto decode those characters. If you really want to do it

Re: Reading unicode chars..

2014-09-03 Thread via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 23:20:38 UTC, Ali Çehreli wrote: On 09/02/2014 02:13 PM, monarch_dodra wrote: > I'd suggest you create a range out of your std.stream.File, which reads > it byte by byte. I was in the process of doing just that. > Then, you pass it to the "byDchar()" range, whic

Re: Reading unicode chars..

2014-09-03 Thread Ali Çehreli via Digitalmars-d-learn
On 09/03/2014 01:21 AM, "Marc Schütz" " wrote: 1) Adding attributes to function calls which I know some are unsafe (see assumeHasAttribs() below). For example, I don't think getc() should be pure. (?) Also, how could all of its functions be nothrow? Is byDchar() is asking too much of its users?

Re: Reading unicode chars..

2014-09-03 Thread via Digitalmars-d-learn
On Wednesday, 3 September 2014 at 13:54:30 UTC, Ali Çehreli wrote: On 09/03/2014 01:21 AM, "Marc Schütz" " wrote: 1) Adding attributes to function calls which I know some are unsafe (see assumeHasAttribs() below). For example, I don't think getc() should be pure. (?) Also, how could all of its

Re: Reading unicode chars..

2014-09-03 Thread seany via Digitalmars-d-learn
On Tuesday, 2 September 2014 at 21:13:04 UTC, monarch_dodra wrote: What's wrong with reading line by line, but processing the characters in said lines 1 by 1? That works "out of the box". import std.stdio; import std.conv; import core.vararg; void main() { string aa = "abc „"; foreac

Re: Reading unicode chars..

2014-09-03 Thread ketmar via Digitalmars-d-learn
On Wed, 03 Sep 2014 15:41:59 + seany via Digitalmars-d-learn wrote: `foreach (dchar aaa; aa)`... signature.asc Description: PGP signature