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 8681585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:32:55+00:00 2026-06-12T21:32:55+00:00

I read some text (known to be in ISO-8859-1) from a TCP socket using

  • 0

I read some text (known to be in ISO-8859-1) from a TCP socket using the read function, then I do some basic substring replacing. Finally I would like to convert the string into the GSM equivalent.

Preferably (but not necessarily) I would do something like this:

size_t i;
for (i=0; i<size; i++) {
  switch (string[i]) {
    case 65:
      //Convert this character
    case 163:
      //Convert this character (the pound symbol £)
  }
}

I prefer the switch for readability, but have considered if-else statements as well.

This works for the normal ASCII characters, but the top part of the ISO-8859-1 is causing me all kind of problems. Apparently they are considered as multiple characters. Any help on how to proceed with the conversion will be much appreciated.

  • 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-12T21:32:56+00:00Added an answer on June 12, 2026 at 9:32 pm

    In your case char seems to be signed. You could use char literals and circumvent the whole issue with the sign of char values beyond ASCII 127:

    /* ascii: */
    case '\000': /* U+0000 - nul */
    ...    
    /* extended ascii: */
    case '\200': /* U+0080 - non-printable control character */
    ...
    case '\243': /* U+00A3 - sterling pound */
    ...
    case '\377': /* U+00ff - lower case y with dieresis */
    

    The conversion is probably more efficiently to implement by a look-up in an array, though.

    If the “extended ASCII” part of your input is represented as multiple characters, it’s likely that your input is actually encoded in UTF-8 or something similar.

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

Sidebar

Related Questions

I am trying to read some info from a text file by using windows
I'm trying to create a list of tasks that I've read from some text
I read a text file to get some info from it and later on
I'm trying to read some information from a text file and put in a
I'm trying to have python read some lines of text from a file and
I'm using jQuery 1.6.2 and calling a function to disable some html text input
Today I read some posts about the 'autocomplete' browser generated in the text fields,
I have a .txt file having some text. I want to read this file
I read Japanese, and want to try processing some Japanese text. I tried this
I have to read a text file and based on some logic, make some

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.