473,382 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How to ignore (or convert) non UTF8 characters?

Hello,

I have a JavaScript function which receives as input a string which in
some cases contain non-UTF8 characters. The output of this function is
used by another utility which fails if it receives any non-UTF8
characters. Is there a way for me to filter out or convert the non-
UTF8 characters in the JavaScript function?

Thanks much!

Feb 27 '07 #1
4 10611
Is there a way for me to filter out or convert the non-
UTF8 characters in the JavaScript function?
Try using the global function escape(). :)

Feb 27 '07 #2
On Feb 27, 1:55 pm, alwhite...@yahoo.com wrote:
Is there a way for me to filter out or convert the non-
UTF8 characters in the JavaScript function?

Try using the global function escape(). :)
Deprecated - instead use encodeURIComponent.

-David

Feb 28 '07 #3
ASM
David Golightly a écrit :
On Feb 27, 1:55 pm, alwhite...@yahoo.com wrote:
>>Is there a way for me to filter out or convert the non-
UTF8 characters in the JavaScript function?
Try using the global function escape(). :)

Deprecated - instead use encodeURIComponent.
What is really different between both ?

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Feb 28 '07 #4
On Feb 27, 4:54 pm, ASM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
David Golightly a écrit :
On Feb 27, 1:55 pm, alwhite...@yahoo.com wrote:
>Is there a way for me to filter out or convert the non-
UTF8 characters in the JavaScript function?
Try using the global function escape(). :)
Deprecated - instead use encodeURIComponent.

What is really different between both ?

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
What they do is similar: they convert non-URI-safe characters to URI-
Hex values eg. ' ' -%20. However, escape will not encode any of
[ @*/+ ] (inside brackets), and the '+' character is interpreted as a
space on the server-side. Also, escape doesn't properly handle non-
ASCII characters. encodeURIComponent makes up for the shortcomings of
escape(). It doesn't encode any of [ ~!*()' ] (which are all URI-
safe).

-David

Feb 28 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: johkar | last post by:
I am in the process of editing the below code I found online, I have a from multi-select list and a to multi-select list. Before rewriting the to list, I want to sort it but ignore the "F - " and...
5
by: Frederik | last post by:
Hi all, I wonder if C# has a build-in utility to convert special characters (for example "&", "<", ">") to the corresponding html entities. If such a utility is not available, can someone tell...
1
by: dongxm | last post by:
Is there a function can convert "abc" to "\u0097\u0098\u0099" in dotnet(c#)
1
by: Hooyoo | last post by:
I read the content from a file encoded with UTF8 like this: byte data = binaryReader.ReadBytes(file.Length); And next step, I want to transform data to ASCII format, How can I do this? You...
2
by: lionel | last post by:
Hi, The HTML of my website is produced in UTF-8. I've got a contact form with a simple textearea. When I send this text : ---------------- This is some text with a second line...
3
by: =?GB2312?B?1qP2zrrA?= | last post by:
hi all, i need to covert the utf8 character to gbk,is that possible?Any idea will be appreciate.
7
by: Laszlo Nagy | last post by:
Peter Bulychev wrote: Please be more specific. There is no general solution. Unicode can handle latin, cyrilic (russian), chinese, japanese and arabic characters in the same string. There are...
7
by: firepol | last post by:
Hello there, I am dealing with files encoded in UTF8 and I can't find a way to convert them into ANSI. I've already searched in google for this since a while, and I'm not achieving the result I...
3
KeredDrahcir
by: KeredDrahcir | last post by:
I'd like to be able to convert speical characters to the ASCII code. There is the option to convert a quote to &quote; but I'd need to convert it to &#34. I need to be able to do this with any...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.