unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Replacement for string-as-unibyte function
@ 2021-01-31  0:34 Joe Riel
  2021-01-31  2:40 ` moasenwood--- via Users list for the GNU Emacs text editor
  2021-01-31  3:35 ` Eli Zaretskii
  0 siblings, 2 replies; 5+ messages in thread
From: Joe Riel @ 2021-01-31  0:34 UTC (permalink / raw)
  To: Help GNU Emacs

As of 26.1, string-as-unibyte is deprecated.  The suggested 
replacement is encode-coding-string.  What coding-system should
be passed to that function to get the equivalent result?

-- 
Joe Riel




^ permalink raw reply	[flat|nested] 5+ messages in thread
* Replacement for string-as-unibyte function
@ 2021-01-31 23:02 Joe Riel
  2021-02-01  3:30 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Riel @ 2021-01-31 23:02 UTC (permalink / raw)
  To: Help GNU Emacs

Apologies for this partial duplicate; after posting realized I no longer
receive email from this group, so renewed.  Am copying and responding to response
from the website:

Eli Zaretskii asks:
> Please describe your use case: what are you trying to do that you
> needed string-as-unibyte?  

Am handling a message passed in from an external process
(its passed in chunks).

The header of the message specifies its length, in bytes.
Some of the characters may be unicode.   Am using
buffer-substring-no-properties to later extract the message.
To get its length write, each byte has to be a character in the buffer.

It appears as though

   (encode-coding-string string 'utf-8-unix)

is the equivalent of (string-as-unibyte string).


-- 
Joe Riel




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-02-01  3:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-31  0:34 Replacement for string-as-unibyte function Joe Riel
2021-01-31  2:40 ` moasenwood--- via Users list for the GNU Emacs text editor
2021-01-31  3:35 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2021-01-31 23:02 Joe Riel
2021-02-01  3:30 ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).