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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:33:46+00:00 2026-05-10T23:33:46+00:00

It seems UITextFields convert all non-breaking spaces (nbsp, U+00A0) to spaces (U+0020). This causes

  • 0

It seems UITextFields convert all non-breaking spaces (nbsp, U+00A0) to spaces (U+0020). This causes problems for the editing of locale specific numbers. For instance, in the French/France locale, the non-breaking space separates 1 and % to form ‘1 %’. However, since the UITextField converts the separator character to a space, the locale aware NSNumberFormatter is unable to parse the locale string and convert it to a number.

The following code snippet illustrates this problem.

NSLocale *fr_FR = [[[NSLocale alloc] initWithLocaleIdentifier:@'fr_FR'] autorelease];  NSNumberFormatter *percentageFormatter = [[NSNumberFormatter alloc] init]; [percentageFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4]; [percentageFormatter setGeneratesDecimalNumbers:TRUE]; [percentageFormatter setNumberStyle:NSNumberFormatterPercentStyle]; [percentageFormatter setLocale:fr_FR];  NSDecimalNumber *one = [NSDecimalNumber decimalNumberWithString:@'0.01'];  // will be '1 %' where the separator character is a nbsp (this is correct) NSString *percentage = [percentageFormatter stringFromNumber:one];  UITextField *textField = [[UITextField alloc] init]; textField.text = percentage;  // will be '1 %' where the separator character is a space (this is wrong) NSString *textFieldValue = textField2.text;  // returns an indeterminate value: may throw an exception, may return nil, etc // this should return the number 0.01 NSNumber *percentageNumber = [percentageFormatter numberFromString:textFieldValue]; 

My question: How do I prevent the UITextField from converting non-breaking spaces to spaces?

I understand the work arounds I can employ to hack this so that it works if I’m in a locale that uses non-breaking spaces. However, if there is property/behavior of the UITextField that I’m not aware of to preserve nbsp, I’d like to know.

  • 1 1 Answer
  • 2 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. 2026-05-10T23:33:47+00:00Added an answer on May 10, 2026 at 11:33 pm

    I’m pretty sure this feature doesn’t exist. How about opening a bug report for the iPhone?

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

Sidebar

Related Questions

Seems to me most of developers completely ignore this features. People prefer handling security
Seems so basic, I can't believe I don't know this! I just need a
I'm programmatically replacing a UITextField with a UITextView, but this seems to break something
I am doing this with UISwitchs and UITextFields... I have declared the UISwitch as
I have some xibs with all sorts of text controls (UITextFields, UITextViews). Since the
All, I ran into this problem where for a UITextField that has secureTextEntry=YES, I
Seems like a simple enough question but I can't seem to find the answer.
Seems like a simple problem: I have an SVN repo inside our firewall. I
Seems like the subtraction is triggering some kind of issue and the resulting value
Seems likes it might be useful to have the assert display a message when

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.