all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Convert the hexadecimal character code to the corresponding Unicode value.
@ 2021-10-01 10:27 Hongyi Zhao
  2021-10-01 10:42 ` Emanuel Berg via Users list for the GNU Emacs text editor
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Hongyi Zhao @ 2021-10-01 10:27 UTC (permalink / raw)
  To: help-gnu-emacs

I noticed some comments on the escape syntax used by Emacs from here
[1-2]. By default, the `describe-char' command will give the code
point representation of the character in hexadecimal and octal
formats, say, #o240, #xa0. So, I want to if there is a convenient way
to do the conversion between the hexadecimal character code
representation and the corresponding Unicode value.

[1] http://ergoemacs.org/emacs/elisp_unicode_representation_in_string.html
[2] (info "(elisp) General Escape Syntax")

Regards, HZ



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Convert the hexadecimal character code to the corresponding Unicode value.
  2021-10-01 10:27 Convert the hexadecimal character code to the corresponding Unicode value Hongyi Zhao
@ 2021-10-01 10:42 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-10-01 13:14   ` Hongyi Zhao
  2021-10-01 10:58 ` Eli Zaretskii
  2021-10-02  6:20 ` Eduardo Ochs
  2 siblings, 1 reply; 18+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-01 10:42 UTC (permalink / raw)
  To: help-gnu-emacs

Hongyi Zhao wrote:

> I noticed some comments on the escape syntax used by Emacs
> from here [1-2]. By default, the `describe-char' command
> will give the code point representation of the character in
> hexadecimal and octal formats, say, #o240, #xa0. So, I want
> to if there is a convenient way to do the conversion between
> the hexadecimal character code representation and the
> corresponding Unicode value.

Leads us to the greatest of all human aspirations:

  https://www.youtube.com/watch?v=xA6DtpRuvSQ

Convert between bases:

#! /bin/zsh
#
# this file:
#   http://user.it.uu.se/~embe8573/conf/.zsh/math
#   https://dataswamp.org/~incal/conf/.zsh/math
#
# [...]

change-base () {
    local from=$1
    local to=$2

    local value=$3

    echo "obase=$to; ibase=$from; $value" | bc
}

# _16 ->
hex2dec () { change-base 16 10 $1 }
hex2oct () { change-base 16  8 $1 }
hex2bin () { change-base 16  2 $1 }

# _10 ->
dec2hex () {
    local dec=$1
    local res
    res=$(change-base    10 16 $dec)
    echo $res:l
}
dec2oct () { change-base 10  8 $1 }
dec2bin () { change-base 10  2 $1 }

# _8 ->
oct2hex () {
    local oct=$1
    local res
    res=$(change-base     8 16 $oct)
    echo $res:l
}
oct2dec () { change-base  8 10 $1 }
oct2bin () { change-base  8  2 $1 }

# _2 ->
bin2hex () {
    local bin=$1
    local res
    res=$(change-base     2 16 $bin)
    echo $res:l
}
bin2dec () { change-base  2 10 $1 }
bin2oct () { change-base  2  8 $1 }

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Convert the hexadecimal character code to the corresponding Unicode value.
  2021-10-01 10:27 Convert the hexadecimal character code to the corresponding Unicode value Hongyi Zhao
  2021-10-01 10:42 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-10-01 10:58 ` Eli Zaretskii
  2021-10-01 13:00   ` Hongyi Zhao
  2021-10-02  6:20 ` Eduardo Ochs
  2 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2021-10-01 10:58 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Hongyi Zhao <hongyi.zhao@gmail.com>
> Date: Fri, 1 Oct 2021 18:27:16 +0800
> 
> I noticed some comments on the escape syntax used by Emacs from here
> [1-2]. By default, the `describe-char' command will give the code
> point representation of the character in hexadecimal and octal
> formats, say, #o240, #xa0. So, I want to if there is a convenient way
> to do the conversion between the hexadecimal character code
> representation and the corresponding Unicode value.

What do you mean by "the corresponding Unicode value", and how is it
different from the hexadecimal codepoint shown by describe-char?



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Convert the hexadecimal character code to the corresponding Unicode value.
  2021-10-01 10:58 ` Eli Zaretskii
@ 2021-10-01 13:00   ` Hongyi Zhao
  2021-10-01 13:15     ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: Hongyi Zhao @ 2021-10-01 13:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

On Fri, Oct 1, 2021 at 6:58 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Hongyi Zhao <hongyi.zhao@gmail.com>
> > Date: Fri, 1 Oct 2021 18:27:16 +0800
> >
> > I noticed some comments on the escape syntax used by Emacs from here
> > [1-2]. By default, the `describe-char' command will give the code
> > point representation of the character in hexadecimal and octal
> > formats, say, #o240, #xa0. So, I want to if there is a convenient way
> > to do the conversion between the hexadecimal character code
> > representation and the corresponding Unicode value.
>
> What do you mean by "the corresponding Unicode value", and how is it
> different from the hexadecimal codepoint shown by describe-char?

Sorry for my inaccurate description. I mean the  "\uxxxx"  or
"\U00xxxxxx" counterpart of the code point represented by
decimal/hexadecimal/octal formats.

HZ



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Convert the hexadecimal character code to the corresponding Unicode value.
  2021-10-01 10:42 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-10-01 13:14   ` Hongyi Zhao
  2021-10-01 17:55     ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 18+ messages in thread
From: Hongyi Zhao @ 2021-10-01 13:14 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs

On Fri, Oct 1, 2021 at 6:42 PM Emanuel Berg via Users list for the GNU
Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> Hongyi Zhao wrote:
>
> > I noticed some comments on the escape syntax used by Emacs
> > from here [1-2]. By default, the `describe-char' command
> > will give the code point representation of the character in
> > hexadecimal and octal formats, say, #o240, #xa0. So, I want
> > to if there is a convenient way to do the conversion between
> > the hexadecimal character code representation and the
> > corresponding Unicode value.
>
> Leads us to the greatest of all human aspirations:
>
>   https://www.youtube.com/watch?v=xA6DtpRuvSQ
>
> Convert between bases:
>
> #! /bin/zsh
> #
> # this file:
> #   http://user.it.uu.se/~embe8573/conf/.zsh/math
> #   https://dataswamp.org/~incal/conf/.zsh/math
> #
> # [...]
>
> change-base () {
>     local from=$1
>     local to=$2
>
>     local value=$3
>
>     echo "obase=$to; ibase=$from; $value" | bc
> }
>
> # _16 ->
> hex2dec () { change-base 16 10 $1 }
> hex2oct () { change-base 16  8 $1 }
> hex2bin () { change-base 16  2 $1 }
>
> # _10 ->
> dec2hex () {
>     local dec=$1
>     local res
>     res=$(change-base    10 16 $dec)
>     echo $res:l
> }
> dec2oct () { change-base 10  8 $1 }
> dec2bin () { change-base 10  2 $1 }
>
> # _8 ->
> oct2hex () {
>     local oct=$1
>     local res
>     res=$(change-base     8 16 $oct)
>     echo $res:l
> }
> oct2dec () { change-base  8 10 $1 }
> oct2bin () { change-base  8  2 $1 }
>
> # _2 ->
> bin2hex () {
>     local bin=$1
>     local res
>     res=$(change-base     2 16 $bin)
>     echo $res:l
> }
> bin2dec () { change-base  2 10 $1 }
> bin2oct () { change-base  2  8 $1 }

See this project which can do base conversion up to 36 easily in Emacs:

https://github.com/AdamNiederer/0xc

But sorry for my inaccurate description. I mean the  "\uxxxx"  or
"\U00xxxxxx" counterpart of the code point represented by
decimal/hexadecimal/octal formats. So the shell script you posted
above is not exactly what I asked.

BTW, why do you use `incar' as your website's main name [1]?

[1] https://dataswamp.org/~incal

HZ



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Convert the hexadecimal character code to the corresponding Unicode value.
  2021-10-01 13:00   ` Hongyi Zhao
@ 2021-10-01 13:15     ` Eli Zaretskii
  0 siblings, 0 replies; 18+ messages in thread
From: Eli Zaretskii @ 2021-10-01 13:15 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Hongyi Zhao <hongyi.zhao@gmail.com>
> Date: Fri, 1 Oct 2021 21:00:56 +0800
> Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
> 
> > > I noticed some comments on the escape syntax used by Emacs from here
> > > [1-2]. By default, the `describe-char' command will give the code
> > > point representation of the character in hexadecimal and octal
> > > formats, say, #o240, #xa0. So, I want to if there is a convenient way
> > > to do the conversion between the hexadecimal character code
> > > representation and the corresponding Unicode value.
> >
> > What do you mean by "the corresponding Unicode value", and how is it
> > different from the hexadecimal codepoint shown by describe-char?
> 
> Sorry for my inaccurate description. I mean the  "\uxxxx"  or
> "\U00xxxxxx" counterpart of the code point represented by
> decimal/hexadecimal/octal formats.

That's just the hexadecimal values you already see, just prefixed with
\u or \U00.  No conversion needed.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Convert the hexadecimal character code to the corresponding Unicode value.
  2021-10-01 13:14   ` Hongyi Zhao
@ 2021-10-01 17:55     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-10-02  1:28       ` Hongyi Zhao
  0 siblings, 1 reply; 18+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-01 17:55 UTC (permalink / raw)
  To: help-gnu-emacs

Hongyi Zhao wrote:

> See this project which can do base conversion up to 36
> easily in Emacs:
>
> https://github.com/AdamNiederer/0xc

Okay, well, yes of course, but it is used sometimes in the
shell - not every day but sometimes - in Emacs I don't think
I ever used it, but if I did I'd do it from the shell after
M-x shell RET.

In the shell however getting Emacs isn't that easy.

Also, since this solution is so simple and general, and that
is all based on the shell tool bc(1), it is more natural to do
that with shell programming.

> But sorry for my inaccurate description. I mean the  "\uxxxx"  or
> "\U00xxxxxx" counterpart of the code point represented by
> decimal/hexadecimal/octal formats.

... an example?

> BTW, why do you use `incar' as your website's main name [1]?
> [1] https://dataswamp.org/~incal

NASCAR (Daytona USA) just suddenly lacked the variety I needed
after a couple of hundred laps ... incar (or IndyCar Racing)
seems to have another drive!

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Convert the hexadecimal character code to the corresponding Unicode value.
  2021-10-01 17:55     ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-10-02  1:28       ` Hongyi Zhao
  2021-10-03  7:40         ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 18+ messages in thread
From: Hongyi Zhao @ 2021-10-02  1:28 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs

On Sat, Oct 2, 2021 at 1:59 AM Emanuel Berg via Users list for the GNU
Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> Hongyi Zhao wrote:
>
> > See this project which can do base conversion up to 36
> > easily in Emacs:
> >
> > https://github.com/AdamNiederer/0xc
>
> Okay, well, yes of course, but it is used sometimes in the
> shell - not every day but sometimes - in Emacs I don't think
> I ever used it, but if I did I'd do it from the shell after
> M-x shell RET.
>
> In the shell however getting Emacs isn't that easy.
>
> Also, since this solution is so simple and general, and that
> is all based on the shell tool bc(1), it is more natural to do
> that with shell programming.
>
> > But sorry for my inaccurate description. I mean the  "\uxxxx"  or
> > "\U00xxxxxx" counterpart of the code point represented by
> > decimal/hexadecimal/octal formats.
>
> ... an example?

a: codepoint 97, #x61 <--> \u0061

♥: BLACK HEART SUIT codepoint 9829, #x2665  <-->  \u2665

😸: GRINNING CAT FACE WITH SMILING EYES codepoint 128568, #x1f638
<--> \U0001f638

HZ



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Convert the hexadecimal character code to the corresponding Unicode value.
  2021-10-01 10:27 Convert the hexadecimal character code to the corresponding Unicode value Hongyi Zhao
  2021-10-01 10:42 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-10-01 10:58 ` Eli Zaretskii
@ 2021-10-02  6:20 ` Eduardo Ochs
  2021-10-02  7:41   ` Hongyi Zhao
  2 siblings, 1 reply; 18+ messages in thread
From: Eduardo Ochs @ 2021-10-02  6:20 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs

Hi Hongyi,

does this help?

                  (string-to-number "1D4E0" 16)
  (char-to-string (string-to-number "1D4E0" 16))
          (string (string-to-number "1D4E0" 16))
     (format "%c" (string-to-number "1D4E0" 16))
          (insert (string-to-number "1D4E0" 16))

The entry for 1D4E0 in UnicodeData.txt is:

  1D4E0;MATHEMATICAL BOLD SCRIPT CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;;

I have some hacks to display the characters around a certain
entry in UnicodeData.txt here,

  http://angg.twu.net/.emacs.html#find-echars-around
  (find-wgeta-elisp "http://angg.twu.net/.emacs" "find-echars-around")

but the code is ugly - I wrote it in a hurry ages ago and never
cleaned the code up...

  Cheers,
    Eduardo Ochs
    http://angg.twu.net/#eev

On Fri, 1 Oct 2021 at 07:28, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>
> I noticed some comments on the escape syntax used by Emacs from here
> [1-2]. By default, the `describe-char' command will give the code
> point representation of the character in hexadecimal and octal
> formats, say, #o240, #xa0. So, I want to if there is a convenient way
> to do the conversion between the hexadecimal character code
> representation and the corresponding Unicode value.
>
> [1] http://ergoemacs.org/emacs/elisp_unicode_representation_in_string.html
> [2] (info "(elisp) General Escape Syntax")
>
> Regards, HZ
>



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Convert the hexadecimal character code to the corresponding Unicode value.
  2021-10-02  6:20 ` Eduardo Ochs
@ 2021-10-02  7:41   ` Hongyi Zhao
  2021-10-02  7:51     ` Eduardo Ochs
  0 siblings, 1 reply; 18+ messages in thread
From: Hongyi Zhao @ 2021-10-02  7:41 UTC (permalink / raw)
  To: Eduardo Ochs; +Cc: help-gnu-emacs

On Sat, Oct 2, 2021 at 2:20 PM Eduardo Ochs <eduardoochs@gmail.com> wrote:
>
> Hi Hongyi,
>
> does this help?
>
>                   (string-to-number "1D4E0" 16)
>   (char-to-string (string-to-number "1D4E0" 16))
>           (string (string-to-number "1D4E0" 16))
>      (format "%c" (string-to-number "1D4E0" 16))
>           (insert (string-to-number "1D4E0" 16))
>
> The entry for 1D4E0 in UnicodeData.txt is:
>
>   1D4E0;MATHEMATICAL BOLD SCRIPT CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;;
>
> I have some hacks to display the characters around a certain
> entry in UnicodeData.txt here,
>
>   http://angg.twu.net/.emacs.html#find-echars-around
>   (find-wgeta-elisp "http://angg.twu.net/.emacs" "find-echars-around")

I tried the code snippet above, but it relies on another function
named as `ee-bol' which is not available there.

HZ



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Convert the hexadecimal character code to the corresponding Unicode value.
  2021-10-02  7:41   ` Hongyi Zhao
@ 2021-10-02  7:51     ` Eduardo Ochs
  2021-10-02  8:13       ` Hongyi Zhao
  0 siblings, 1 reply; 18+ messages in thread
From: Eduardo Ochs @ 2021-10-02  7:51 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs

On Sat, 2 Oct 2021 at 04:41, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>
> On Sat, Oct 2, 2021 at 2:20 PM Eduardo Ochs <eduardoochs@gmail.com> wrote:
> >
> > Hi Hongyi,
> >
> > does this help?
> >
> >                   (string-to-number "1D4E0" 16)
> >   (char-to-string (string-to-number "1D4E0" 16))
> >           (string (string-to-number "1D4E0" 16))
> >      (format "%c" (string-to-number "1D4E0" 16))
> >           (insert (string-to-number "1D4E0" 16))
> >
> > The entry for 1D4E0 in UnicodeData.txt is:
> >
> >   1D4E0;MATHEMATICAL BOLD SCRIPT CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;;
> >
> > I have some hacks to display the characters around a certain
> > entry in UnicodeData.txt here,
> >
> >   http://angg.twu.net/.emacs.html#find-echars-around
> >   (find-wgeta-elisp "http://angg.twu.net/.emacs" "find-echars-around")
>
> I tried the code snippet above, but it relies on another function
> named as `ee-bol' which is not available there.
>
> HZ

Hi Hongyi,

`find-echars-around' uses several functions from eev...
For example `ee-bol', that is defined here:

  https://github.com/edrx/eev/blob/UTF-8/eepitch.el#L217

[[]] =/, E.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Convert the hexadecimal character code to the corresponding Unicode value.
  2021-10-02  7:51     ` Eduardo Ochs
@ 2021-10-02  8:13       ` Hongyi Zhao
  2021-10-02 17:39         ` Eduardo Ochs
  0 siblings, 1 reply; 18+ messages in thread
From: Hongyi Zhao @ 2021-10-02  8:13 UTC (permalink / raw)
  To: Eduardo Ochs; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1547 bytes --]

On Sat, Oct 2, 2021 at 3:51 PM Eduardo Ochs <eduardoochs@gmail.com> wrote:
>
> On Sat, 2 Oct 2021 at 04:41, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
> >
> > On Sat, Oct 2, 2021 at 2:20 PM Eduardo Ochs <eduardoochs@gmail.com> wrote:
> > >
> > > Hi Hongyi,
> > >
> > > does this help?
> > >
> > >                   (string-to-number "1D4E0" 16)
> > >   (char-to-string (string-to-number "1D4E0" 16))
> > >           (string (string-to-number "1D4E0" 16))
> > >      (format "%c" (string-to-number "1D4E0" 16))
> > >           (insert (string-to-number "1D4E0" 16))
> > >
> > > The entry for 1D4E0 in UnicodeData.txt is:
> > >
> > >   1D4E0;MATHEMATICAL BOLD SCRIPT CAPITAL Q;Lu;0;L;<font> 0051;;;;N;;;;;
> > >
> > > I have some hacks to display the characters around a certain
> > > entry in UnicodeData.txt here,
> > >
> > >   http://angg.twu.net/.emacs.html#find-echars-around
> > >   (find-wgeta-elisp "http://angg.twu.net/.emacs" "find-echars-around")
> >
> > I tried the code snippet above, but it relies on another function
> > named as `ee-bol' which is not available there.
> >
> > HZ
>
> Hi Hongyi,
>
> `find-echars-around' uses several functions from eev...
> For example `ee-bol', that is defined here:
>
>   https://github.com/edrx/eev/blob/UTF-8/eepitch.el#L217

Got it. I must activate eev it first as follows:

(use-package eev
  :straight (:host github :repo "edrx/eev")
  :config
  (eev-beginner)
  )

Then, when I hit `M-x fea RET' in the scratch buffer, I get a lot of
garbage code as shown in the screenshot attached here.

HZ

[-- Attachment #2: eev.png --]
[-- Type: image/png, Size: 76344 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Convert the hexadecimal character code to the corresponding Unicode value.
  2021-10-02  8:13       ` Hongyi Zhao
@ 2021-10-02 17:39         ` Eduardo Ochs
  2021-10-03  4:37           ` Hongyi Zhao
  0 siblings, 1 reply; 18+ messages in thread
From: Eduardo Ochs @ 2021-10-02 17:39 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs

On Sat, 2 Oct 2021 at 05:13, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>
> Got it. I must activate eev it first as follows:
>
> (use-package eev
>   :straight (:host github :repo "edrx/eev")
>   :config
>   (eev-beginner)
>   )
>

Hi Hongyi,

can you check if this looks good and works?
If it is ok I'll add it to the documentation...

(use-package eev
  :straight (:host github :repo "edrx/eev")
  :config (progn
           ;; See: (find-eev "eev-load.el" "autoloads")
           ;; http://angg.twu.net/eev-current/eev-load.el.html#autoloads
           (require 'eev-load)
           ;; (eev-mode 1)     ; optional
           ;; (eev-beginner)   ; optional
           ))

Thanks in advance! =)
  Eduardo Ochs
  http://angg.twu.net/#eev



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Convert the hexadecimal character code to the corresponding Unicode value.
  2021-10-02 17:39         ` Eduardo Ochs
@ 2021-10-03  4:37           ` Hongyi Zhao
  2021-10-03  6:05             ` Eduardo Ochs
  0 siblings, 1 reply; 18+ messages in thread
From: Hongyi Zhao @ 2021-10-03  4:37 UTC (permalink / raw)
  To: Eduardo Ochs; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 609 bytes --]

On Sun, Oct 3, 2021 at 1:39 AM Eduardo Ochs <eduardoochs@gmail.com> wrote:
> Hi Hongyi,
>
> can you check if this looks good and works?
> If it is ok I'll add it to the documentation...
>
> (use-package eev
>   :straight (:host github :repo "edrx/eev")
>   :config (progn
>            ;; See: (find-eev "eev-load.el" "autoloads")
>            ;; http://angg.twu.net/eev-current/eev-load.el.html#autoloads
>            (require 'eev-load)
>            ;; (eev-mode 1)     ; optional
>            ;; (eev-beginner)   ; optional
>            ))

Still, only garbage is generated, as shown in the attachment.

HZ

[-- Attachment #2: eev-1.png --]
[-- Type: image/png, Size: 100660 bytes --]

[-- Attachment #3: eev-2.png --]
[-- Type: image/png, Size: 111021 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Convert the hexadecimal character code to the corresponding Unicode value.
  2021-10-03  4:37           ` Hongyi Zhao
@ 2021-10-03  6:05             ` Eduardo Ochs
  2021-10-03  7:25               ` Hongyi Zhao
  0 siblings, 1 reply; 18+ messages in thread
From: Eduardo Ochs @ 2021-10-03  6:05 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs

On Sun, 3 Oct 2021 at 01:38, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>
> Still, only garbage is generated, as shown in the attachment.

Oops, I didn't realize that there was an implicit question in your
e-mail...

I use `M-x fea' (a.k.a. `find-echars-around') like this: I visit
/usr/share/unicode/UnicodeData.txt and I search for characters in it
by name... for example, suppose that I've found this line in
UnicodeData.txt:

2203;THERE EXISTS;Sm;0;ON;;;;;Y;;;;;

it looks interesting, and I know that usually a character that I find
interesting is part of a family of characters that I will also find
interesting. So I type M-x fea with point on that line that starts
with 2203, and it displays the 200 characters before 0x2203, then char
0x2203 on a line by itself, then the 200 characters after 0x2203...

I told you that this was just a quick hack, and I though that you
would look at the code, find references to some functions that you
were looking for, and use those functions on your code...

  Cheers =),
    E.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Convert the hexadecimal character code to the corresponding Unicode value.
  2021-10-03  6:05             ` Eduardo Ochs
@ 2021-10-03  7:25               ` Hongyi Zhao
  0 siblings, 0 replies; 18+ messages in thread
From: Hongyi Zhao @ 2021-10-03  7:25 UTC (permalink / raw)
  To: Eduardo Ochs; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1305 bytes --]

On Sun, Oct 3, 2021 at 2:05 PM Eduardo Ochs <eduardoochs@gmail.com> wrote:
>
> On Sun, 3 Oct 2021 at 01:38, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
> >
> > Still, only garbage is generated, as shown in the attachment.
>
> Oops, I didn't realize that there was an implicit question in your
> e-mail...
>
> I use `M-x fea' (a.k.a. `find-echars-around') like this: I visit
> /usr/share/unicode/UnicodeData.txt and I search for characters in it
> by name... for example, suppose that I've found this line in
> UnicodeData.txt:
>
> 2203;THERE EXISTS;Sm;0;ON;;;;;Y;;;;;

$ cat ~/aaa
2203;THERE EXISTS;Sm;0;ON;;;;;Y;;;;;

`C-x C-f ~/aaa RET M-x fea RET'

See the attachment.

>
> it looks interesting, and I know that usually a character that I find
> interesting is part of a family of characters that I will also find
> interesting. So I type M-x fea with point on that line that starts
> with 2203, and it displays the 200 characters before 0x2203, then char
> 0x2203 on a line by itself, then the 200 characters after 0x2203...
>
> I told you that this was just a quick hack, and I though that you
> would look at the code, find references to some functions that you
> were looking for, and use those functions on your code...

Maybe I have not yet understood the level of your use, at least for now.

HZ

[-- Attachment #2: eev-3.png --]
[-- Type: image/png, Size: 118092 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Convert the hexadecimal character code to the corresponding Unicode value.
  2021-10-02  1:28       ` Hongyi Zhao
@ 2021-10-03  7:40         ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-10-03  7:44           ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 18+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-03  7:40 UTC (permalink / raw)
  To: help-gnu-emacs

Hongyi Zhao wrote:

>>> But sorry for my inaccurate description. I mean the
>>> "\uxxxx" or "\U00xxxxxx" counterpart of the code point
>>> represented by decimal/hexadecimal/octal formats.
>>
>> ... an example?
>
> a: codepoint 97, #x61 <--> \u0061
>
> ♥: BLACK HEART SUIT codepoint 9829, #x2665  <-->  \u2665
>
> 😸: GRINNING CAT FACE WITH SMILING EYES codepoint 128568, #x1f638
> <--> \U0001f638

I don't know if there is Elisp for that ATM but if there isn't
it looks like a simple substitution problem?

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Convert the hexadecimal character code to the corresponding Unicode value.
  2021-10-03  7:40         ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-10-03  7:44           ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 18+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-03  7:44 UTC (permalink / raw)
  To: help-gnu-emacs

>>>> But sorry for my inaccurate description. I mean the
>>>> "\uxxxx" or "\U00xxxxxx" counterpart of the code point
>>>> represented by decimal/hexadecimal/octal formats.
>>>
>>> ... an example?
>>
>> a: codepoint 97, #x61 <--> \u0061
>>
>> ♥: BLACK HEART SUIT codepoint 9829, #x2665  <-->  \u2665
>>
>> 😸: GRINNING CAT FACE WITH SMILING EYES codepoint 128568, #x1f638
>> <--> \U0001f638
>
> I don't know if there is Elisp for that ATM but if there isn't
> it looks like a simple substitution problem?

Does `describe-char' do that?

If so, check it out (it is in descr-text.el) and see how it is
done first hand ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-10-03  7:44 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-01 10:27 Convert the hexadecimal character code to the corresponding Unicode value Hongyi Zhao
2021-10-01 10:42 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-01 13:14   ` Hongyi Zhao
2021-10-01 17:55     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-02  1:28       ` Hongyi Zhao
2021-10-03  7:40         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-03  7:44           ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-01 10:58 ` Eli Zaretskii
2021-10-01 13:00   ` Hongyi Zhao
2021-10-01 13:15     ` Eli Zaretskii
2021-10-02  6:20 ` Eduardo Ochs
2021-10-02  7:41   ` Hongyi Zhao
2021-10-02  7:51     ` Eduardo Ochs
2021-10-02  8:13       ` Hongyi Zhao
2021-10-02 17:39         ` Eduardo Ochs
2021-10-03  4:37           ` Hongyi Zhao
2021-10-03  6:05             ` Eduardo Ochs
2021-10-03  7:25               ` Hongyi Zhao

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.