[Linux-programlama] yardım talebi

---------

[Linux-programlama] yardım talebi

From: Eyup Ozer <eyupozer_at_gmail.com>
Date: Wed, 3 Sep 2008 14:05:12 +0300
Message-ID: <bf4113d80809030405p9870a3cw90b4ca14846dc82c@mail.gmail.com>

ArkadaÅŸlar merhaba,
labourstart.org dünyanın her yerinden yüzlerce gönüllü sendikacının sendika
ve işçi hakları konusunda haberleri girdiği gönüllü ve kar amacı gütmeyen
bir internet sitesi. Yakın zamanda sitenin kullandığı yazılım değiştirildi
ama bazı problemlerle karşılaşıyorlarmış. Açııkcası ben bu konularda pek
bilgi sahibi olmadığım için, belki yardım eden çıkar diye soruları bu gruba
göndereyim dedim. Sorulara http://labourstart.wordpress.com/ adresinden
ulaşabilirsiniz ve cevabınızı yorum bölümüne yazabilirsiniz.Ayrıca oradaki
tüm soruları aşağıya da yapıştırıyorum. Bu arada ingilizce olarak cevap
yazmaya üşenirseniz anlarım, siz cevabı yazın ben ingilizceye çevirir
gönderirim. Şimdiden çok teşekkürler,

1. Conversion of text from Unicode - problem with Perl
Text::Iconv<http://labourstart.wordpress.com/2008/09/03/1-conversion-of-text-from-unicode-problem-with-perl-texticonv/>
3
September 2008 by labourstart

LabourStart <http://www.labourstart.org/> has recently converted its news
links database to Unicode. As we now work in 22 languages, it's important
that we be able to show characters correctly — including in our lists of
languages displayed at the top of every page on the site.

But … most union websites don't use Unicode. And the JavaScript newswires
we created, which now generate Unicode characters, were causing problems.
So we've gone into the script which creates the JavaScript every 30 minutes
and told it to convert Unicode back into character encodings like iso-8859-1
(for Western languages), windows-1251 (for Russian), etc.

The problem is, while this works like a charm on the Russian, it's not
working on Norwegian — or not converting all the characters, not even all
the comon ones.

Here is a page showing the current Norwegian JavaScript
newswire<http://www.labourstart.org/cgi-bin/lnw/show.pl?url=http://www.labourstart.org/rdf/labourstart.no.js&char=iso-8859-1>.
To see the characters correctly displaying in Unicode, go
here<http://www.labourstart.org/no/>
.

We're using a Perl module - Text::Iconv to do this. Here is the code:

if ($langcode eq "no") {$converter = Text::Iconv->new("utf-8″,
"iso-8859-1″);}

$Header = $converter->convert("$Header");

Can anyone help sort this out for us?

2. How to allow apostrophes to be added to fields in MySQL database
using PHP?<http://labourstart.wordpress.com/2008/09/03/2-how-to-allow-apostrophes-to-be-added-to-fields-in-mysql-database-using-php/>
3
September 2008 by labourstart

We discovered this problem on LabourStart's Italian page. If we try to add
a news story and in the source field key in, for example, l'Unita, the
attempt is rejected. We're using a Perl script to do this, and the relevant
lines are follow. The field source field is called $source and you can see
that the new input field is enclosed in apostrophes, which is almost
certainly what's causing the problem. Can you help us?

Here's the code:

use DBI;

$db = DBI->connect('dbi:mysql:***:***','***','***');

if ($modify eq 1) { # delete old record first
$db->do("DELETE FROM news WHERE url='$url'") || die ('Could not delete
record.');
}
$db->do("INSERT INTO news (url, header, country, country2, date, priority,
userid, source, formoreinfo, language, regreqd, keywords, image,
actnowcampaigncode, state, dateposted) VALUES ('$url', '$header',
'$country1′, '$country2′, $date, $priority, '$userid', '$source',
'$formoreinfo', '$language', '$regreqd', '$keywords', '$image',
'$actnowcampaigncode', '$state', $date)") || die (print qq|<span
style="color: red; font-weight: bold; background-color: yellow; padding:
5px; border: 1px red dotted">Could not add record.</span>|);

$db->disconnect();

3. A simple MySQL sorting
question<http://labourstart.wordpress.com/2008/09/03/3-a-simple-mysql-sorting-question/>
3
September 2008 by labourstart

In the PHP code for the page which shows our news in Norwegian, we sort in
descending order based on the date field. The problem is that this means
that the newest items added to the database within a single date are moved
to the bottom. How can we keep the newest items on top?

Here is the code we're using:

$query2 = "SELECT * FROM news WHERE language = 'no' order by date DESC
LIMIT 100″;

4. Pound sign breaking
database<http://labourstart.wordpress.com/2008/09/03/4-pound-sign-breaking-database/>
3
September 2008 by labourstart

In our new MySQL database to which we are adding records using a Perl
script, the entire thing now in Unicode, keying in the sign for pounds
sterling (£) is resulting in an error character. This may be due to it
being enclosed in apostrophes in our script. The filed is called header and
the variable being added to it is $header. Can you help us fix this?
Thanks.

The relevant line is here:

$db->do("INSERT INTO news (url, header, country, country2, date, priority,
userid, source, formoreinfo, language, regreqd, keywords, image,
actnowcampaigncode, state, dateposted) VALUES ('$url', '$header',
'$country1′, '$country2′, $date, $priority, '$userid', '$source',
'$formoreinfo', '$language', '$regreqd', '$keywords', '$image',
'$actnowcampaigncode', '$state', $date)") || die (print qq|<span
style="color: red; font-weight: bold; background-color: yellow; padding:
5px; border: 1px red dotted">Could not add record.</span>|);

_______________________________________________
Linux-programlama mailing list
Linux-programlama_at_liste.linux.org.tr
http://liste.linux.org.tr/mailman/listinfo/linux-programlama
Received on Wed 03 Sep 2008 - 13:28:02 EEST

---------

Bu arsiv hypermail 2.2.0 tarafindan uretilmistir.