bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#8827: Problem in url-cache


From: Eli Zaretskii
Subject: bug#8827: Problem in url-cache
Date: Thu, 09 Jun 2011 10:37:37 +0300

> From: Nick Dokos <nicholas.dokos@hp.com>
> Date: Wed, 08 Jun 2011 19:35:45 -0400
> Cc: Julien Danjou <julien@danjou.info>, nicholas.dokos@hp.com
> 
> (defun url-cache-extract (fnam)
>   "Extract FNAM from the local disk cache."
>   (erase-buffer)
>   (insert-file-contents-literally fnam))
> 
> But it seems that in a multibyte context, what url-store-in-cache
> stores and what url-cache-extract retrieves are not identical:
> the former stores a sequence of bytes as they come from the network
> and the latter may combine individual bytes into multibyte entities.
> 
> My workaround for this problem is
> 
> --8<---------------cut here---------------start------------->8---
> diff --git a/lisp/url/url-cache.el b/lisp/url/url-cache.el
> index 1615920..80d7702 100644
> --- a/lisp/url/url-cache.el
> +++ b/lisp/url/url-cache.el
> @@ -192,6 +192,7 @@ Very fast if you have an `md5' primitive function, 
> suitably fast otherwise."
>  (defun url-cache-extract (fnam)
>    "Extract FNAM from the local disk cache."
>    (erase-buffer)
> +  (set-buffer-multibyte nil)
>    (insert-file-contents-literally fnam))

That's not a workaround, that's exactly the fix for this bug.
Inserting binary data into a multibyte buffer does not leave the
binary data unaltered.  The buffer must be unibyte.





reply via email to

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