473,836 Members | 1,858 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 2666
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
1500
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
4209
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
8574
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
1256
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
2708
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
1363
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
19550
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
10301
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
9436
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
9810
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
9654
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
10526
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...
0
10237
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9348
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7770
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...
1
4436
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
3999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3094
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.