473,976 Members | 29,589 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stuck on characters with accents, file_get_conten ts, regex

1 New Member
Hi, I'm trying to write code to update nightly some NHL stats. Everything works, except for names with an accent, e.g. José Théodore. This won't generate a match no matter what I try. I've edited the code to show the relevant pieces. What I use:

[PHP]
$data = file_get_conten ts('http://avalanche.nhl.c om/team/app?service=pag e&page=Stats' );

$regex = '/'.str_replace(" ", "\s", $row2['name']).'<\/a>\n<\/td>...........
preg_match($reg ex, $data, $match);


[/PHP]

I've tried changing the field's character encoding to utf8_general_ci . I've also tried to run a strtr on the pulled page, but doing an echo on it shows no change. I've also tried using the name with and without accents in my database.

How can I get this to work? I can't get a match when using accents.
Mar 25 '08 #1
1 2674
hsriat
1,654 Recognized Expert Top Contributor
Use mb_ereg_match.
May 20 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
1505
by: G. Stewart | last post by:
The objective is to extract the first n characters of text from an HTML block. I wish to preserve all HTML (links, formatting etc.), and at the same time, extend the size of the block to ensure that all closing tags are recovered. For example, simply extracting the first 400 characters of a HTML block may result in an <i> opening tag being including, but its closing tag being excluding. Or a link may get chopped halfway - may be the...
2
4214
by: Alain | last post by:
Hi, I am working on a project where I need to convert international characters with acii values. Like André -> andre and Björn -> bjorn. How can I do this without replacing every single character? lastname = lastname.Replace("â", "a"); lastname = lastname.Replace("é", "e"); lastname = lastname.Replace("ö", "o");
12
8595
by: Julien ARNOUX | last post by:
Hi, I'd like to use regular expressions in sqlite query, I using apsw module but it doesn't work...Can you help me ? My script: import apsw import re path = 'db/db.db3'
4
1264
by: Johny | last post by:
I have string="""<span class="test456">55</span>. <td><span class="test123">128</span> <span class="test789">170</span> """ where I need to replace <span class="test456">55</span>. <span class="test789">170</span>
3
2716
by: aspineux | last post by:
My goal is to write a parser for these imaginary string from the SMTP protocol, regarding RFC 821 and 1869. I'm a little flexible with the BNF from these RFC :-) Any comment ? tests= def RN(name, regex): """protect using () and give an optional name to a regex""" if name:
0
1372
by: =?Utf-8?B?Slc=?= | last post by:
I read some advice given to someone here to use RegEx to get around invalid XML characters. Goran Djuranovic asked the question in 1-21-2007. The advice was given by Keith Patrick and Goran replied saying it was working fine. I'm a beginner in object oriented languages. I'm interested in getting more information on how to use the RegEx for this purpose. I'm getting an exception error on the read using xmltextreader when the...
9
19569
by: albert | last post by:
Hi, I can't get the characters with accents in a regex. This is my code : - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - var MyText1 = "éléphant1" ; var MyText2 = "elephant1" ; var MyReg = /^+$/ ; if(MyReg.test(MyText1)) alert(MyText1 + " is OK") ;
7
10311
xNephilimx
by: xNephilimx | last post by:
lHi guys! I'm having a little problem that's getting on my nerves, I couldn't find a solution, I also tryed googling it and I found nothing... (my field of expertise is in AS 2 and 3, but I still lack some JavaScript solid knowdlege) The problem is that when I try to send a form's content with Ajax (I'm using the prototype library), for some reason the latin characters (accents and stuff, like áéíóú) turn a mess when I try to store them in...
6
9443
by: Shiao | last post by:
Hello, I'm trying to build a regex in python to identify punctuation characters in all the languages. Some regex implementations support an extended syntax \p{P} that does just that. As far as I know, python re doesn't. Any idea of a possible alternative? Apart from manually including the punctuation character range for each and every language, I don't see how this can be done. Thank in advance for any suggestions.
0
10355
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10171
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11408
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11573
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
8462
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5153
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.