Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8132019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:14:33+00:00 2026-06-06T09:14:33+00:00

I went as far as searching C sources, but I can’t find this function,

  • 0

I went as far as searching C sources, but I can’t find this function, and I really don’t want to write one myself because it absolutely must be there.

To elaborate: Unicode points are represented as U+######## – this is easy to get, what I need, is the format the character is written to a file (for example). A Unicode codepoint translates to bytes such that 7 bits of the rightmost byte are written to the first byte, then 6 bits of the next bits are written into the next byte and so on. Emacs certainly knows how to do it, but there’s no way I can find to get the byte sequence of UTF-8 encoded string from it as a sequence of bytes (each containing 8 bits).

Functions such as get-byte or multybite-char-to-unibyte work only with characters that can be represented using no more then 8 bits. I need the same thing what get-byte does, but for multibyte characters, so that instead of an integer 0..256 I’d receive either a vector of integers 0..256 or a single long integer 0..2^32.

EDIT

Just in case anyone will need this later:

(defun haxe-string-to-x-string (s)
  (with-output-to-string
    (let (current parts)
      (dotimes (i (length s))
        (if (> 0 (multibyte-char-to-unibyte (aref s i)))
            (progn
              (setq current (encode-coding-string
                             (char-to-string (aref s i)) 'utf-8))
              (dotimes (j (length current))
                (princ (format "\\x%02x" (aref current j)))))
          (princ (format "\\x%02x" (aref s i))))))))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T09:14:34+00:00Added an answer on June 6, 2026 at 9:14 am

    encode-coding-string might be what you’re looking for:

    *** Welcome to IELM ***  Type (describe-mode) for help.
    ELISP> (encode-coding-string "eĥoŝanĝo ĉiuĵaŭde" 'utf-8)
    "e\304\245o\305\235an\304\235o \304\211iu\304\265a\305\255de"
    

    It returns a string, but you can access the individual bytes with aref:

    ELISP> (aref (encode-coding-string "eĥoŝanĝo ĉiuĵaŭde" 'utf-8) 1)
    196
    ELISP> (format "%o" 196)
    "304"
    

    or if you don’t mind using cl functions, concatenate is your friend:

    ELISP> (concatenate 'list (encode-coding-string "eĥoŝanĝo ĉiuĵaŭde" 'utf-8))
    (101 196 165 111 197 157 97 110 196 157 111 32 196 137 105 117 196 181 97 197 173 100 101)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As far as I can see, it is necessary to have access to write
I'm running Mac OS so I can't really tell if this effect is presented
I'm running a drupal site and implementing esi support. So far it went ok
I went through this whole procedure http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx a couple weeks ago and got https
I went to connect to my website via firefox earlier this afternoon and I
I went to download SharpZipLib assemblies but it looks like its not on SourceForge.
I went to http://www.asp.net/mvc/ to try to install ASP.NET MVC. I didn't know, but
This might be a 2 part question. First one is what am I doing
I'm trying to write code that can print only filled text boxes in the
Somehow my mind went far away from the current problem and I made a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.