title: Translate Unicode (UTF-8) codepoint to bytes
body: <p>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.</p>
  
  <p>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).</p>
  
  <p>Functions such as <code>get-byte</code> or <code>multybite-char-to-unibyte</code> work only with characters that can be represented using no more then 8 bits. I need the same thing what <code>get-byte</code> 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.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Just in case anyone will need this later:</p>
  
  <pre><code>(defun haxe-string-to-x-string (s)
    (with-output-to-string
      (let (current parts)
        (dotimes (i (length s))
          (if (&gt; 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))))))))
  </code></pre>