[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unicode characters display issue
From: |
Eli Zaretskii |
Subject: |
Re: Unicode characters display issue |
Date: |
Sun, 02 Jul 2023 15:25:07 +0300 |
> From: Thanos Apollo <public@thanosapollo.com>
> Cc: emacs-devel@gnu.org
> Date: Sun, 02 Jul 2023 14:53:59 +0300
>
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > It's hard to answer your questions without knowing what you did,
> > exactly. Can you come up with a simplified Lisp program that behaves
> > like you describe, so that we could study it and see what you are
> > doing wrong?
>
> Thanks for the reply!
>
> ```
> (switch-to-buffer (url-retrieve-synchronously
> "https://www.youtube.com/results?search_query=greece+survivor" t t))
> ```
>
> After evaluating the above code and searching forward for "videoid"
> you will be presented with unicode character sequences.
This is a unibyte buffer: "M-: enable-multibyte-characters RET"
reports nil. So what you see are raw bytes of the encoded text. You
need to decode it, e.g., by using decode-coding-region. The header
says "Content-Type: text/html; charset=utf-8", so the coding-system to
use in decoding is utf-8. For example:
(decode-coding-region (point-min) (point-max) 'utf-8
(get-buffer-create "decoded"))