LoginSignup
1
0

More than 5 years have passed since last update.

SBCLでバイト列から文字列への変換で詰まった話

Posted at

SBCLでバイト列から文字列への変換で詰まった。

octets-to-string_test_error.lisp
(sb-ext:octets-to-string #(102 111 111) :external-format :utf-8)

そうすると以下のエラーが出る。

#<THREAD "main thread" RUNNING {10005605B3}>:
  The value
    #(102 111 111)
  is not of type
    (VECTOR (UNSIGNED-BYTE 8))
  when binding VECTOR

どうもunsigned-byte型のベクトルじゃないとダメらしい。

octets-to-string_test.lisp
(sb-ext:octets-to-string (concatenate '(vector (unsigned-byte 8)) #(102 111 111)) :external-format :utf-8)
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0