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
This forum is meant for general questions about the usability of OJS from an everyday user's perspective: journal managers, authors, and editors are welcome to post questions here, as are librarians and other support staff. We welcome general questions about the role of OJS and how the workflow works, as well as specific function- or user-related questions.

What to do if you have general, workflow or usability questions about OJS:

1. Read the documentation. We've written documentation to cover from OJS basics to system administration and code development, and we encourage you to read it.

2. take a look at the tutorials. We will continue to add tutorials covering OJS basics as time goes on.

3. Post a question. Questions are always welcome here, but if it's a technical question you should probably post to the OJS Technical Support subforum; if you have a development question, try the OJS Development subforum.

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: 923
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 2 guests