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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:04:22+00:00 2026-06-07T02:04:22+00:00

My program interfaces with servers in other countries and regularly needs to handle URLs

  • 0

My program interfaces with servers in other countries and regularly needs to handle URLs containing foreign characters. This works fine until we consider Scandinavian characters such as æ, ø, and å. When I receive a URL, I decode it as follows:

-(NSString*)urlDECODE:(NSString*)string
{
    NSString*   s = [string stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

    return (s)?s:string;
}

This fails to properly decode these characters, however:

filename: æøåa.rtf
input: %C3%83%C2%A6%C3%83%C2%B8a%C3%8C%C2%8Aa.rtf
output: æøaÌa.rtf

EDIT: This is the encoding function:

NSString * URLEncode(NSString * url)
{
    NSString* out = nil;
    @try
    {
        NSLog(@"BEFORE=%@",url);
        out = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        NSLog(@"AFTER=%@",out);
    }
    @catch (NSException * e)
    {
        NSLog(@"Encoding error: %@", e);
    }

return out;
}
  • 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-07T02:04:24+00:00Added an answer on June 7, 2026 at 2:04 am

    It seems your original URL is already mistakenly encoded in UTF-8.

    "æøåa.rtf" == "\xc3\xa6\xc3\xb8a\xcc\x8aa.rtf"
                   == "æ"      "ø"    "a\u030a" "a.rtf"  // in UTF-8
                   == "æøåa.rtf"
    

    Please check the constructed NSString passed to URLEncode(). The other code you’ve shown are correct (except that it’s rare to handle exceptions in Objective-C).

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

Sidebar

Related Questions

I'm building a site in django that interfaces with a large program written in
I am implementing basic socket program , but in this case i want the
I have a program which interfaces with a radio I am using via a
I want to define a method interceptor in a Java program in other words
I am writing a c++ program that interfaces with an Apache FtpServer using libcurl.
I'm making a program for AIX 5.3 in Python 2.6.1 that interfaces with an
I'm trying to program an Android interface which uses an expandable list on the
I keep hearing the statement on most programming related sites: Program to an interface
I have a program with a GUI interface whose initial set-up I need to
I am creating a program which has an installer-like interface. Is it better to

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.