This question already has an answer here:
NSString to Emoji Unicode
(1 answer)
Closed 6 years ago.
I am receiving the string #"\\U0001F603" from an API, which is the Unicode code point for the emoji 😃.
I want to display it using an UILabel's text property. If I directly set it, it shows \U0001F603 instead of the actual emoji.
How can I display the emoji at the received Unicode code point?
You have to remove first slash.
like this
label.text=#"\U0001F603";
😃.
This usually helps me
[NSString stringWithUTF8String:model.UTF8String];
Related
This question already has answers here:
Converting UTF8 to ANSI (ISO-8859-1) in Delphi
(2 answers)
Closed 3 years ago.
I have spent most of the day looking for a solution but i can't figure it out, so i thought i'd ask the experts here.
In Outlook there is a mail message with attachments, some of the attachments have a filename with words like 'dossier pièces signée'.
We import the mail in the application but we noticed something strange with the filename of the attachment, the filename we save in the database does not match the actual filename.
After a long search i discovered the 'è' character is actually 2 characters and when i paste this in notepadd++ and show it as ansi i get 'pieÌ€ces' instead of 'pièces', so i think (but am unsure) this filename is a url encoded filename.
Since we don't do unicode or utf-8 in our database i think it would be best to store the filename after converting it to ansi, however i can't find any Delphi function that returns it like to the notepad++ format.
Does anyone have any advice please?
In delphi 2010 and after there's a Utf82Ansi internal function.
See more details in that answer here in stackoverflow: Converting UTF8 to ANSI (ISO-8859-1) in Delphi
This question already has answers here:
iOS: Issue with ampersand in the URL string
(6 answers)
Closed 9 years ago.
In my app I am passing a string to service which sets some data to remote database. Everything works perfect as far as I don't have "&" in my string.
I am using this to pass the parameters:
NSString *urlString = [[NSString
stringWithFormat:#"http://someservice.com/some/some_setstatus.php?status=active&name=%#",
merchant] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
My guess is when it's checking the name with the name saved in the database, it's not able to find one because of '&'.
You are unable to pass "&", as it will be treated as a delimiter for URL parameters. "&" is a reserved character and you can consider encoding "&" as a combination of allowed characters. Take a look at RFC 3986 and the answer to this question.
You need to escape the & character for url (more info: http://www.ietf.org/rfc/rfc3986.txt)
Have a look at https://github.com/tagyro/GTM/blob/master/Foundation/GTMNSString%2BURLArguments.h
This is a clone of Google Toolbox for Mac from their SVN.
I believe you need to urlEncode to the string which will properly encode any special characters. See http://www.w3schools.com/tags/ref_urlencode.asp for more information.
Regards,
Steve
I am writing a utility app for some coworkers. The app is essentially a custom notepad, with buttons that represent the shorthand they use to transcribe a task. All of the buttons add a string to arrays that I have set up to hold the transcript, and I add the strings to the row arrays like this.
[currentRow addObject:#"("];
Some of the shorthand needs to be written in subscript, and some in superscript. There are not Unicode characters for all of the characters that I need, so I have been trying to sort through the code around Attributed Strings,but I'm not quite getting it. Does anyone have advice on this or some sample code?
Also, after this transcript is printed to the screen during transcription, I send it to an email message body.. so I assume I'll need to worry about formatting there as well. I am currently using plain text, but the email could be HTML. Thanks!
If you display the text in a WebView you can use html tags to set superscript. It also has the advantage to run on older iOS versions and you can reuse the text in your mail.
NSString *myText=#"This text contains <sub>subscript</sub> and <sup>superscript</sup> text.";
[self.myWebView loadHTMLString:myText baseURL:nil];
I got an app, where i download data through JSON. But when i am trying to show NSStrings i see something like this:
\u041e\u041d\u0410!!! etc.
How can I decode it into normal symbols?
in our team for this problem we create our own decoder
You'll see \u041e\u041d\u0410!!! only in NSLog's console view.. just assign NSSTring's value to some UILabel or UITextField it will show properly
If you log just for example nsdictioanry you will see unicode \u041e\u041d\u0410, but if you will log NSString (objectForKey:#"key") it will be ok.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Standard URL encode function?
I need to transofrm a Delphi string (like TEdit.Caption) in a "url capable" string.
I need this because I will open google maps programmatically like in TEdit I write "High Street, Sydney"
and then i would like to open the browser at maps.google.com/maps?q=High+Street+Sidney
Is there a ready function to do this, also to parse accents?
You can add IdURI unit from Indy to your uses clause, and use TIdURI.URLEncode() method to encode a URL, and TIdURI.Decode() to decode an encoded URL to a normal string.