|
|
|
|
#1 |
|
Junior Member
Join Date: Feb 2006
Posts: 44
|
Removing invalid characters from a string
I don't know if I'm not looking hard enough, but I couldn't find a topic on this, so I'm posting it here.
Essentially, in my nsis program I'm running some of the files have strange characters like " ®" or "©". They're problemful for me and I need them removed from the string itself. So for example, $0 contains: "Application Name Example® v1.0" I need it to become: "Application Name Example v1.0" I know there are results about removing the more standard 'found on keyboard' invalid characters, but what about ones like these? I've tried: code: But that doesn't seem to work. Any workaround to this? |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
|
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Feb 2006
Posts: 44
|
I took a look at that function before hand, and from what I gather, all it does is flag me if the string contains an invalid character, correct me if I'm wrong.
I need to actually remove it from the string though |
|
|
|
|
|
#4 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
I think it'd be best to write your own function for this. Iterate through all characters in A and copy to B ignoring any characters that are invalid.
Stu |
|
|
|
|
|
#5 | |
|
Major Dude
Join Date: Mar 2003
Posts: 571
|
Quote:
PHP Code:
code: |
|
|
|
|
|
|
#6 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
That method will never do unless you know the complete set of characters you have to remove. It would be simpler, as you say, to only include valid ASCII characters. A custom function is likely needed unless a solution already exists.
Stu |
|
|
|
![]() |
|
|||||||
| Tags |
| invalid character delete |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|