473,602 Members | 2,751 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Transliterate characters

In perl I was able to do:

$var =~ y/ĘÓĄŚŁŻŹĆŃęóąśłż źćń/EOASLZXCNeoaslz xcn/;

How does this oneliner look like in php?

Leszek Dubiel

PS. Already searched for help...and found no answer....
Jul 17 '05 #1
2 1673
On Fri, 20 Aug 2004 11:05:22 -0700, Leszek Dubiel wrote:
In perl I was able to do:

$var =~ y/ĘÓĄŚŁŻŹĆŃęóąśłż źćń/EOASLZXCNeoaslz xcn/;

How does this oneliner look like in php?

Leszek Dubiel

PS. Already searched for help...and found no answer....

PHP >= 4.3.0
$var = html_entity_dec ode($var, ENT_NOQUOTES);
Example taken from:
<http://uk.php.net/manual/en/function.html-entity-decode.php>
Pre-4.3.0 solution on that page also.
HTH =)

Regards,

Ian

--
Ian.H
digiServ Network
London, UK
http://digiserv.net/

Jul 17 '05 #2
"Leszek Dubiel" <le****@dubiel. pl> wrote in message
news:72******** *************** ***@posting.goo gle.com...
In perl I was able to do:

$var =~ y/ĘÓĄŚŁŻŹĆŃęó ąśł
żźćń/EOASLZXCNeoaslz xcn/;
How does this oneliner look like in php?

Leszek Dubiel

PS. Already searched for help...and found no answer....


The strtr() function is the PHP equivalent. The syntax is more verbose but
clearer.

$trans_tbl = array(
'&#280' => 'E',
'Ó' => 'O',
'&#260' => 'A',
....
);
$s = strtr($s, $trans_tbl);
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
47805
by: Pikkel | last post by:
i'm looking for a way to replace special characters with characters without accents, cedilles, etc.
7
8980
by: Roy W. Andersen | last post by:
I've been searching google about this for days but can't find anything, so I'm hoping someone here can help me out. I'm trying to create zip-files without needing the zip-file extension in PHP, mainly because I need the ability to both create and extract zip-files. I've tried a couple of classes found here and there, and they all seem to have the same problem. I'm currently using PclZip (http://phpconcept.net/pclzip/) but even the...
9
8143
by: Safalra | last post by:
The idea here is relatively simple: a java program (I'm using JDK1.4 if that makes a difference) that loads an HTML file, removes invalid characters (or replaces them in the case of common ones like Microsoft's 'smartquotes'), and outputs the file. The problem is these files will be on disk, so the program won't have the character encoding information from the server. Questions:
43
3724
by: Vladimir | last post by:
Method UnicodeEncoding.GetMaxByteCount(charCount) returns charCount * 2. Method UTF8Encoding.GetMaxByteCount(charCount) returns charCount * 4. But why that? Look: /* Each Unicode character in a string is defined by a Unicode scalar value, also called ...
4
3839
by: wob | last post by:
Many thanks for those who responded to my question of "putting greek char into C string". In searching for an solution, I noticed that there are more than one version of "Extended ASCII characters"(No. 128 to 255) . e.g., in one version No. 224 is the symbol alpha, in another, it's a "a" with a ` on it... How come? You can see it here: http://www.kturby.com/cables/ascii2.htm
20
9357
by: SMG | last post by:
Hi All, I have created an application which is working fine and is in about to launch, now suddenly my mgmt says there are chances that Scrip ID( a particular id and not prim key) may have special characters like '&,*,),( or /' This data(field/key) I am passing this value as a querystring. e.g. value to be passed : ABC http://localhost/myProj/abc.aspx?ScripID=ABC
11
11130
by: Ron L | last post by:
I have a barcode scanner which uses a "keyboard wedge" program so that the data it scans comes through as if it was typed on a keyboard. I am trying to have the data in the barcode be displayed in a text box. I know that there are certain control characters embedded in the data that I want to display substitutions for in the text box, for instance I want to replace ASCII character 04 with the string "<EOT>". I have tried doing a simple...
9
3922
by: Nathan Sokalski | last post by:
I have several TextBoxes with TextMode="MultiLine" in which I want to limit the number of characters that can be entered using a RegularExpressionValidator. I have come up with the following ValidationExpression: {0,250} The only problem with this ValidationExpression is that it does not include the \n character as stated on the following documentation page:
6
2152
by: Deep | last post by:
Suppose there is a character of one byte then max characters possible under this are 256. If characters are of two bytes then max chars should be 65536. Now if character can be of one byte or two byte then how many characters are possible and why? Also write a program to read and write characters in such type of encoding. Would you people help me to do this?
3
10191
KevinADC
by: KevinADC | last post by:
Purpose The purpose of this article is to discuss the difference between characters inside a character class and outside a character class and some special characters inside a character class. This is not a regular expression tutorial. Assumes you are already familiar with basic regular expression concepts and terminology. If not, you may want to read some regular expression tutorial. See the end of the article for links to online resources....
0
7993
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
6730
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
5867
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
5440
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3900
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
3944
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2418
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
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1254
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.