I've been trying to blog using g-client. Everything works perfectly as
long as I don't use accented characters.
Whenever I use accented characters, I get the following message:
HTTP/1.1 400 Bad Request
Content-Type: text/plain
Transfer-Encoding: chunked
Cache-control: private
Date: Tue, 26 Jun 2007 14:24:52 GMT
Server: GFE/1.3
org.xml.sax.SAXParseException: The element type "entry" must
be terminated by the matching end-tag "</entry>".
I've tried to track down the problem and it seems that the character
coding problem occurs when g-client sends the buffer contents to the
XSLT processor (the function "g-xsl-transform-region").
I've tried to put everything I can (buffers, buffer output, etc.) into
UTF-8, but nothing I have tried seems to make much difference. I wrote
up what I have tried so far for the gnu.emacs.help group, but it seems
my post created more questions than it answered...
Any ideas on where I should look and what I should try?
Thanks,
Joe
(string-bytes
(encode-coding-string
(buffer-substring-no-properties (point-min) (point-max)) 'utf-8-
unix))
It seems working for me.
Brilliant! It works!
Many thanks.
Joe
Function position-bytes in Emacs 22 might be more optimal for
this --
try something like
(defsubst buffer-bytes (buffer)
"Return number of bytes in a buffer."
(save-excursion
(set-buffer buffer)
(position-bytes (point-max))))
If this works, I'll check it in; I cannot test this readily since
it is not easy for me to work in a unicode environment.
(defsubst buffer-bytes (buffer)
"Return number of bytes in a buffer."
(save-excursion
(set-buffer buffer)
(1- (position-bytes (point-max)))))
and it works fine so far. Thanks.