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

  • Home
  • SEARCH
  • 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 6911649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:59:04+00:00 2026-05-27T08:59:04+00:00

When I was reading from a usocket stream using the code below: (let ((stream

  • 0

When I was reading from a usocket stream using the code below:

(let ((stream (socket-stream sk)) line)
  (loop for line = (read-line stream)
     while line do (format t line)))

when read-line meets an non-ascii charactor, it throw out an exception:

decoding error on stream
#<SB-SYS:FD-STREAM
  for "socket 118.229.141.195:52946, peer: 119.75.217.109..."
  {BCA02F1}>
(:EXTERNAL-FORMAT :UTF-8):
  the octet sequence (176) cannot be decoded.
   [Condition of type SB-INT:STREAM-DECODING-ERROR]

Neither read-line nor read-byte works, so I tried to use trivial-utf-8 to read utf-8 string
using read-utf-8-string, but It only accepts a binary stream, it seems socket-stream does not create a binary stream, so I was confused how to read from a socket stream that has non-ascii charactors?

  • 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-05-27T08:59:05+00:00Added an answer on May 27, 2026 at 8:59 am

    You can first read-sequence (if you know the length ahead of time) or read-bytes while there are some, and then convert them to string with (babel:octets-to-string octets :encoding :utf-8)) (where octets is (make-array expected-length :element-type '(unsigned-byte 8))).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm reading from the standard input using the read() system call but there's a
While reading from a site a read that you can not make a global
I have one process who's reading from a file (using file.read() ) and one
I'm reading from a text file using AJAX. How do I read only the
I'm reading from a boost::asio::ip::udp::socket like this: using boost::asio::ip::udp; // ... char recv_buf[128]; udp::endpoint
I am reading from a NetworkStream that is in a while loop. The issue
When reading from a IO::Socket::INET filehandle it can not be assumed that there will
I'm reading from a byte stream that contains a series of variable length descriptors
In order to improve performance reading from a file, I'm trying to read the
Using Windows So I'm reading from a binary file a list of unsigned int

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.