emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: default charset for text/html selection in X11


From: Eli Zaretskii
Subject: Re: default charset for text/html selection in X11
Date: Wed, 21 Jun 2023 20:13:21 +0300

> From: Robert Pluim <rpluim@gmail.com>
> Date: Wed, 21 Jun 2023 17:51:19 +0200
> 
> (defun html-mode--html-yank-handler (_type html)
>   (save-restriction
>     (insert html)
>     (ignore-errors
>       (sgml-pretty-print (point-min) (point-max)))))
> 
> insert any codepoints > 127 as their constituent raw bytes
> instead, eg U+A0 ends up as \xc2\xa0 in the buffer.
> 
> I *think* it should be OK to assume utf-8 here, and thus do:
> 
> (defun html-mode--html-yank-handler (_type html)
>   (save-restriction
>     (insert (decode-coding-string html 'utf-8 t))
>     (ignore-errors
>       (sgml-pretty-print (point-min) (point-max)))))
> 
> but I canʼt find a normative reference for that (if this was http, the
> default charset would be iso-8859-1, but this isnʼt http).

How about looking in the sources of Chromium?

If the encoding doesn't have to be UTF-8, forcing UTF-8 there might
not be the best idea.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]