Juanma, thank you for the lisp code that reproduces the same problem that I am having.
If a space is inserted at the beginning of the buffer, then the result is correct (as stated in my bug report):
(with-temp-buffer
(insert " ")
(insert (make-string 20 ?.))
(decode-coding-region 2 (point-max) 'us-ascii)
(buffer-string))
" ...................."
(I use 'us-ascii just to show the coding does not matter).
Now, hopefully emacs developers will be able to understand and fix the problem.
On Fri, Feb 20, 2009 at 22:13, mj <mj54590@gmail.com> wrote:Could it be related to bug#1809?
> (apply 'decode-coding-region (point-min) (point-max) 'us-ascii nil)
>
> The original buffer content would be something like this:
>
> B7040400-12
> some text here
>
> after decode-coding-region is executed, the buffer content became:
>
> ^@7040450-12
> some text here
>
> Where ^@ is actually binary code \0 (not ascii ^ and @). There is another instance
> that a string was decoded and the result is ^@ prefixed.
(with-temp-buffer
(insert (make-string 20 ?.))
(decode-coding-region 1 (point-max) 'raw-text)
(buffer-string))
=> "^@..................."
Juanma