Hi everyone!
This is my first posting but hopefully not my last. I have a small problem with matching Swedish characters i Perl. I'm developing a simple database script that recieves a string from an html-form and matches the string against every line in a file. If there's a match I print it. The code goes something like this:
foreach (@lines) {
s/\n$//;
@items = split /$field_separator/;
$item_str = $items[$field-1];
if ( $item_str =~ m/^$search_str$/i) {
# We have a match, do something!
}
}
The case-insensitive matching works fine, as long as the strings don't contain any special swedish characters, like å, ä or ö. If $item_str contains the character ä and $search_str the character Ä I dont get a match. It is very important that this works (most of our customers are Swedish) and I know there is an easy solution to my problem. I just can't remember it.
I hope someone can help me.
Jocke
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.