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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:41:30+00:00 2026-06-07T22:41:30+00:00

Our code calls stringWithUTF8String but some data we have uses an octal sequence \340

  • 0

Our code calls stringWithUTF8String but some data we have uses an octal sequence \340 in the string. This causes some code to break because we never expect the function to return nil. I did some research and found that any octal sequence from \200-\777 will give the same result. I know I can handle this returning nil but I want to understand why it would return nil, and what those octal escapes are interpreted as.

NSString *result = [NSString stringWithUTF8String:"Mfile \340 xyz.jpg"];

running this code return nil for result. It appears that to code defensively we will have to check null results for this everywhere where we use it which seems unfortunate. The documentation for the function does not say anything about returning nil as a possibility. I would bet that there is a lot of code out there that does not check for it either.

  • 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-07T22:41:31+00:00Added an answer on June 7, 2026 at 10:41 pm

    I added a category which is called safeStringWithUTF8String: this is called everywhere instead it simply checks the return value for nil and returns the empty string if not valid. Not great but not sure what else to do we have to be able to handle any data passed in.

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

Sidebar

Related Questions

In our code we have quite a few cases of this pattern: class outerClass
Currently our code uses a for-loop for filling a buffer holding a Unicode string
My DBA calls his column names something different than how our code uses the
We have a long standing bug in our production code. This is essentially a
Our VB6 program currently calls code in a C++ dll. This dll does not
In our code I have the following, for now please ignore the //* bits;
This is our code: <div> <table style=width: 349px> <tr> <td class=style1> <asp:ListBox ID=leftbox runat=server
I just saw some code in our code base (and it's OLD code, as
When profiling our code I was surprised to find millions of calls to C:\Python26\lib\encodings\utf_8.py:15(decode)
Currently, when we update our PHP code for our website, we have a script

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.