UNICODED string into array

G

Guest

Hi !

I have an issue where I have to process string character by character
and when special character occurs I need to make some action.

The problem is that the string consists
unicode characters as well so when I do something like
@a = split //, $mystring
I get multiple entries (from two to 4 bytes).

What I need to do is mostly to replace those characters with some normal
character (X for example)

Let's say I have unicode character with the code 010f.

$mystring=~s/\u{010f}/X/g doesn't work.

Any idea ? Should I use some speciall library to do that ?
 
M

MSG

Hi !

I have an issue where I have to process string character by character
and when special character occurs I need to make some action.

The problem is that the string consists
unicode characters as well so when I do something like
@a = split //, $mystring
I get multiple entries (from two to 4 bytes).

What I need to do is mostly to replace those characters with some normal
character (X for example)

Let's say I have unicode character with the code 010f.

$mystring=~s/\u{010f}/X/g doesn't work.

Any idea ? Should I use some speciall library to do that ?

Cookbook Recipe 1.8 "Treating Unicode Combined Characters
as Single Characters".
 
D

DJ Stunks

MSG said:
Cookbook Recipe 1.8 "Treating Unicode Combined Characters
as Single Characters".

Are there different versions of the Cookbook? My 1.8 is "Expanding
Variables in User Input"

-jp
 
M

MSG

Didnt help me much. I used regex substitution like ~s/e/X/g

Maybe I should have asked you this from the very beginning:
what do you get after the substitution? or what do mean by
"not working"? You should post a short code piece and tell us
what you get by running it.

Are you on Windows/Linux/Mac...?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,183
Messages
2,570,967
Members
47,517
Latest member
Andres38A1

Latest Threads

Top