473,804 Members | 3,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

iconv to strip out specfic language characters

hello group,

I cannot figure out how to use iconv to "normalize" characters
specific to some language. I need it in file upload where I take a
file from local disc and then save to server and use in web pages, for
example, as img source.

What should be the second parameter of the function?

Say,
iconv('ISO-8859-1', 'ASCII//TRANSLIT', $str);
works but it gives too much transformed result.

I would like just replace specific chars, like "a acute", "a with
macron", "a umlaut", with a character without accent.
Andra.

Apr 24 '07 #1
2 3507
On Apr 24, 2:44 pm, kkadr...@yahoo. com wrote:
hello group,

I cannot figure out how to use iconv to "normalize" characters
specific to some language. I need it in file upload where I take a
file from local disc and then save to server and use in web pages, for
example, as img source.

What should be the second parameter of the function?

Say,
iconv('ISO-8859-1', 'ASCII//TRANSLIT', $str);
works but it gives too much transformed result.

I would like just replace specific chars, like "a acute", "a with
macron", "a umlaut", with a character without accent.

Andra.
Hello Andra,

Try using

iconv('ISO-8859-1', 'ASCII//IGNORE', $str);

instead of

iconv('ISO-8859-1', 'ASCII//TRANSLIT', $str);

You can find more detailed info at http://www.php.net/manual/en/function.iconv.php
(Note the user's comments they are really useful).

Mityok.

Apr 25 '07 #2
thank you,
I will stay now with
$str = iconv('ISO-8859-1', 'ASCII//IGNORE', $str);

Disappointingly that there is not such a function that would convert
language-specific characters to their ascii look-alikes. For me it
does not matter so much that it is not the same and more correct
representation would be specific for each language and so on so on...
I just need filenames to be used without problems and recognizable to
the author.

hello group,

I cannot figure out how to use iconv to "normalize" characters
specific to some language. I need it in file upload where I take a
file from local disc and then save to server and use in web pages, for
example, as img source.

What should be the second parameter of the function?

Say,
iconv('ISO-8859-1', 'ASCII//TRANSLIT', $str);
works but it gives too much transformed result.

I would like just replace specific chars, like "a acute", "a with
macron", "a umlaut", with a character without accent.

Andra.

Hello Andra,

Try using

iconv('ISO-8859-1', 'ASCII//IGNORE', $str);

instead of

iconv('ISO-8859-1', 'ASCII//TRANSLIT', $str);

You can find more detailed info at http://www.php.net/manual/en/function.iconv.php
(Note the user's comments they are really useful).

Mityok.
May 7 '07 #3

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

Similar topics

3
5078
by: pbuchheit | last post by:
I need to convert Japanese characters to UTF-8. I tried using this command on a PHP 5.0.3 server: $out = iconv("iso-2022-jp", "utf-8", $in); But it does not work. Can anyone tell me what I'm doing wrong? (Note: I also tried this, unsuccessfully, with Chinese characters: $out = iconv("gb2312", "utf-8", $in); )
6
9094
by: Mark C | last post by:
All, Is there such a function that can strip all non alpha ( not between a-z) characters from a string? I have a function that I currently use that will strip one character at a time from a string that I tried tweaking without success. Any help would be much appreciated. Thanks in advance, Mark C. hereinde@yahoo.com
6
1870
by: Adrian Lin | last post by:
Is there a way to read a specfic line in a text file? For instance if I wanted to just read the 5th line is that possible without having to step through the other lines? Essentially I am doing huge calculations in which genetic matrices are saved in text files instead of being held in arrays that take up memory. I am trying to do something where the genetic matrix is stored in a text file and I call specfic lines for calculations then put...
5
8725
by: dan.j.weber | last post by:
I'm using Python 2.3.5 and when I type the following in the interactive prompt I see that strip() is not working as advertised: >>>s = 'p p:p' >>>s.strip(' :') 'p p:p' Is this just me or does it not work? I want to get rid of all ' ' and ':' in the string. I've checked the doc and from what I can tell this is what strip() is supposed to do. Thanks for any help.
1
4724
by: yong | last post by:
I want to use iconv.h to convert some text to another charset. The code is below: ====== #include <stdio.h> #include <stdlib.h> #include <iconv.h> int main()
4
5184
by: B.r.K.o.N.j.A | last post by:
Does anyone has any experience with these two, I've lost a s**tload of time trying to make them work with a well formed xml document encoded in windows-1250 encoding, but simplexml works only with utf-8 and iso-8859-1 and iconv-ing the string with original xml in it ($isostr=iconv('WINDOWS-1250', 'ISO-8859-1', $winstr);) before xml parsing did no good (illegal characters, which i could //IGNORE or //TRANSLIT but then I would loose...
3
2372
by: Colin J. Williams | last post by:
The Library Reference has strip( ) Return a copy of the string with the leading and trailing characters removed. The chars argument is a string specifying the set of characters to be removed. If omitted or None, the chars argument defaults to removing whitespace. The chars argument is not a
5
10487
by: kp | last post by:
Hi, I am compiling on an AIX 5.1 box and my test machine is AIX 5.3. I run the foll. steps for compiling my test binary "test" /usr/vacpp/bin/xlC test.c -c -o test.o -I/home/jag/progs/include -I/ usr/lpp/application/include /usr/vacpp/bin/xlC -o test -L/home/jag/progs/lib -L/usr/lib -L/usr/lpp/ application/lib -brtl -s test.o -lapplicationapi -liconv
4
2290
by: Poppy | last post by:
I'm using versions 2.5.2 and 2.5.1 of python and have encountered a potential bug. Not sure if I'm misunderstanding the usage of the strip function but here's my example. var = "detail.xml" print var.strip(".xml") ### expect to see 'detail', but get 'detai' var = "overview.xml" print var.strip(".xml") ### expect and get 'overview' I have a work around using the replace function which happens to be the
0
9582
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
10335
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
10323
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,...
0
9157
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
7621
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
6854
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
5652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
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
3821
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.