Re: how to get the \uxxxx unicode code from a char

2014-10-16 Thread Sean Kelly via Digitalmars-d-learn
On Tuesday, 14 October 2014 at 20:08:03 UTC, Brad Anderson wrote: On Tuesday, 14 October 2014 at 20:05:07 UTC, Brad Anderson wrote: https://github.com/D-Programming-Language/phobos/blob/master/std/json.d#L579 Oops. Linked the the parser section. I actually don't see any unicode escape

Re: how to get the \uxxxx unicode code from a char

2014-10-14 Thread Sean Kelly via Digitalmars-d-learn
On Tuesday, 14 October 2014 at 19:47:00 UTC, jicman wrote: Greetings. Imagine this code, char[] s = ABCabc; foreach (char c; s) { // how do I convert c to something an Unicode code? ie. \u. } I'd look at the JSON string encoder.

how to get the \uxxxx unicode code from a char

2014-10-14 Thread jicman via Digitalmars-d-learn
Greetings. Imagine this code, char[] s = ABCabc; foreach (char c; s) { // how do I convert c to something an Unicode code? ie. \u. } thanks.

Re: how to get the \uxxxx unicode code from a char

2014-10-14 Thread ketmar via Digitalmars-d-learn
On Tue, 14 Oct 2014 19:46:57 + jicman via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: char[] s = ABCabc; foreach (char c; s) { // how do I convert c to something an Unicode code? ie. \u. } string res; foreach (dchar ch; s) res ~= \\u%04X.format(ch); //

Re: how to get the \uxxxx unicode code from a char

2014-10-14 Thread jicman via Digitalmars-d-learn
On Tuesday, 14 October 2014 at 19:49:16 UTC, Sean Kelly wrote: On Tuesday, 14 October 2014 at 19:47:00 UTC, jicman wrote: Greetings. Imagine this code, char[] s = ABCabc; foreach (char c; s) { // how do I convert c to something an Unicode code? ie. \u. } I'd look at the JSON string

Re: how to get the \uxxxx unicode code from a char

2014-10-14 Thread Brad Anderson via Digitalmars-d-learn
On Tuesday, 14 October 2014 at 20:05:07 UTC, Brad Anderson wrote: https://github.com/D-Programming-Language/phobos/blob/master/std/json.d#L579 Oops. Linked the the parser section. I actually don't see any unicode escape encoder in here. Perhaps he meant the upcoming JSON module.

Re: how to get the \uxxxx unicode code from a char

2014-10-14 Thread Brad Anderson via Digitalmars-d-learn
On Tuesday, 14 October 2014 at 20:03:37 UTC, jicman wrote: On Tuesday, 14 October 2014 at 19:49:16 UTC, Sean Kelly wrote: On Tuesday, 14 October 2014 at 19:47:00 UTC, jicman wrote: Greetings. Imagine this code, char[] s = ABCabc; foreach (char c; s) { // how do I convert c to something an

Re: how to get the \uxxxx unicode code from a char

2014-10-14 Thread Brad Anderson via Digitalmars-d-learn
On Tuesday, 14 October 2014 at 20:08:03 UTC, Brad Anderson wrote: On Tuesday, 14 October 2014 at 20:05:07 UTC, Brad Anderson wrote: https://github.com/D-Programming-Language/phobos/blob/master/std/json.d#L579 Oops. Linked the the parser section. I actually don't see any unicode escape

Re: how to get the \uxxxx unicode code from a char

2014-10-14 Thread jicman via Digitalmars-d-learn
On Tuesday, 14 October 2014 at 19:56:29 UTC, ketmar via Digitalmars-d-learn wrote: On Tue, 14 Oct 2014 19:46:57 + jicman via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: char[] s = ABCabc; foreach (char c; s) { // how do I convert c to something an Unicode code? ie.

Re: how to get the \uxxxx unicode code from a char

2014-10-14 Thread jicman via Digitalmars-d-learn
On Tuesday, 14 October 2014 at 20:13:17 UTC, Brad Anderson wrote: On Tuesday, 14 October 2014 at 20:08:03 UTC, Brad Anderson wrote: On Tuesday, 14 October 2014 at 20:05:07 UTC, Brad Anderson wrote: https://github.com/D-Programming-Language/phobos/blob/master/std/json.d#L579 Oops. Linked the

Re: how to get the \uxxxx unicode code from a char

2014-10-14 Thread Ali Çehreli via Digitalmars-d-learn
On 10/14/2014 01:18 PM, jicman wrote: Thanks. This is a missing function in std.uni or std.string. josé I don't know D1 but there is std.utf.decode: http://dlang.org/phobos/std_utf.html#decode Ali