OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



bug in OAI response

Are you an Editor, Author, or Journal Manager in need of help? Want to talk to us about workflow issues? This is your forum.

Moderators: jmacgreg, michael, vgabler, John

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

bug in OAI response

Postby bollini » Mon Nov 15, 2004 3:38 am

Hi OJS/OCS users,
I have found a bug in OAI class that affects installation of OJS/OCS on web servers with a charset encoding different from ISO-8859-1.
The OAI class assumes that the Web Server runs with the ISO-8859-1 charset. Thus it converts data in UTF-8 for display in OAI response. The solution, for web servers with UTF-8 charset encoding, is to eliminate the traslation from ISO-8859-1 to UTF-8 in:

function prepOutput(&$data) {
if(!is_array($data)) { $data = utf8_encode(htmlspecialchars($data)); }
else {
foreach($data as $k => $v) {
if(is_array($data[$k])) {
$this->prepOutput($data[$k]);
} else {
$data[$k] = utf8_encode(htmlspecialchars($v));
}
}
}
return $data;
}


For a complete solution depending from HTML_CHARSET you can use this code:


function prepOutput(&$data) {
if (HTML_CHARSET == 'ISO-8859-1') {
if(!is_array($data)) { $data = utf8_encode(htmlspecialchars($data)); }
else {
foreach($data as $k => $v) {
if(is_array($data[$k])) {
$this->prepOutput($data[$k]);
} else {
$data[$k] = utf8_encode(htmlspecialchars($v));
}
}
}
return $data;
}
else {
if(!is_array($data)) { $data = htmlspecialchars($data); }
else {
foreach($data as $k => $v) {
if(is_array($data[$k])) {
$this->prepOutput($data[$k]);
} else {
$data[$k] = htmlspecialchars($v);
}
}
}
return $data;
}
}
bollini
 
Posts: 13
Joined: Thu May 27, 2004 5:51 am
Location: Italia

bug in OAI response

Postby rsshaw » Thu Jul 28, 2005 2:42 pm

Andrea,

Thanks for posting this information. I encountered the problem and this allowed me to quickly fix it.

I do not know what my server is using; phpinfo() says that
_SERVER["HTTP_ACCEPT_CHARSET"] ISO-8859-1,utf-8;q=0.7,*;q=0.7
which mentions both charsets.

In any case, I had seen a symptom where it looked like things already in UTF-8 were being treated as if in ISO-8859 and being translated again into UTF-8. This made the name "Peña" appear as "Peña".

I found the OAI Repository Explorer helpful in testing the problem. It is at
http://re.cs.uct.ac.za/
rsshaw
 
Posts: 7
Joined: Tue Jan 25, 2005 6:23 pm
Location: Cupertino, Calif

OAI Encoding

Postby ramon » Mon Aug 01, 2005 9:10 am

People,

If you did any studiying of the OAI-PMH protocol standards you would know that UTF-8 is the required as the character encoding, because of internationalization and W3C recommendations.

You may want to rethink your solution....
ramon
 
Posts: 945
Joined: Wed Oct 15, 2003 6:15 am
Location: Brasí­lia/DF - Brasil


Return to OJS Editorial Support and Discussion

Who is online

Users browsing this forum: No registered users and 1 guest