OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



bug in viewtemplates.tpl

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

Re: bug in viewtemplates.tpl

Postby newone » Tue Jan 21, 2014 6:29 am

Hello Alec,

Your insight is very much needed here.

On a similar note on database, I am noticing some strange issues that has to do with character encoding issues. For example, after a successful upgrade, I noticed that if apostrophe, double quotations, or if a tick mark is on any letters, in the article title, abstract, and authors bio, it creates an issues. This is what happens:

While logged in as an admin, if I click on an affected article (the affected articles sometimes have a black circle with a question mark symbol in the middle of the circle and sometimes, affected articles do not have any weird symbols), I will see the title, abstract, keywords, authors bio, and indexing information. All these will show up when viewing a submission or published piece. This is where it gets wonky. When I click "Edit Metadata" for the affected article, I notice that the data in the bio and abstracts, and sometimes the title are not there. In other words, the bio and abstracts boxes are blank when you click Edit the Metadata, but the text will display if you are not editing the metadata of the article. In many cases, bio and abstracts are always the one affected, and few times, the title. I do not know how the text shows up when not logged in as a user, and when not editing the article submission even though you are logged in as an admin.

I have also noticed some of the same issue in announcement. If you have double quotation marks " " or apostrophe, it spits out a little black circle like above. To make sure I do not loose the information entered originally, I have to open different 2 browser tabs. The first tab is to show the actual announcement as it would appear to the website visitor, and the other tab is for editing the actual announcement. When logged in as the admin, if I click the edit link to edit the actual announcement, there is no text in the two boxes. So, while anyone can view the announcement, when you click to edit the announcement, the text disappears. If you hit save, you loose data that shows up on the frontend but not in the backend.

At one time, I did set this character set in the configuration to on.

Database connection character set
connection_charset = On

Database storage character set
database_charset = On

Enable character normalization to utf-8 (recommended)
charset_normalization = On


In my database, some of the tables have the collation as latin1_swedish_ci and some have utf8_general_ci collation?

Should I change to utf8_general_ci collation? If changing to utf8_general_ci collation, will these solve the issues?
newone
 
Posts: 134
Joined: Tue Nov 17, 2009 2:30 am

Re: bug in viewtemplates.tpl

Postby asmecher » Tue Jan 21, 2014 6:39 am

Hi newone,

For a proper UTF8 setup, the client_charset setting should be "utf-8"; the connection_charset and database_charset should be "utf8"; and the database tables should be using utf8_general_ci collation.

The specific errors you're encountering could be due to the above settings, or could be due to the use of charset_normalization (suggest turning this off in config.inc.php), or they could be due to the use of Microsoft Smart Quotes. These are non-standard character set extensions for quotes and apostrophes. Often they'll show up if you've pasted content in from other sources. Generally if you have a clean setup as above they won't cause problems, but they may indicate other character set issues.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8591
Joined: Wed Aug 10, 2005 12:56 pm

Re: bug in viewtemplates.tpl

Postby newone » Wed Jan 22, 2014 12:27 am

Hi Alec,

I checked the database. The database collation is latin1_swedish. Is there a way to change the collation and all the tables in the database to utf8_general_ci collation to have a clean setup?

I checked the config and the client_charset setting is "utf-8". The connection_charset, database_charset, and charset normalization are all on. It does not appear this is working optimally as different tables have different character. Or does this matter?

Only these tables are "utf8_general_ci" in the database:
article_notes
books_for_review
books_for_review_authors
books_for_review_settings
citations
citation_settings
controlled_vocabs
controlled_vocab_entries
controlled_vocab_entry_settings
external_feeds
external_feed_settings
filters
filter_settings
metadata_descriptions
metadata_description_settings
processes
user_interests


I have also turned off normalization, and will check to see if there are improvement.
newone
 
Posts: 134
Joined: Tue Nov 17, 2009 2:30 am

Re: bug in viewtemplates.tpl

Postby asmecher » Wed Jan 22, 2014 4:56 am

Hi newone,

See e.g. http://stackoverflow.com/questions/2543993/convert-a-mysql-database-from-latin-to-utf-8 for information about transcoding databases.

Note that your connection_charset and database_charset should not be "on" -- they should be a character set; see above.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8591
Joined: Wed Aug 10, 2005 12:56 pm

Re: bug in viewtemplates.tpl

Postby newone » Wed Jan 22, 2014 11:06 pm

Hi Alec,

It should be made a bit clearer in the documentation that there is no "On". If you take a new OJS and look at the config file, it says:

; Database connection character set
connection_charset = Off

; Database storage character set
database_charset = Off

So, if the database collation is utf8, then those should be:
connection_charset = utf-8
database_charset = utf-8

NOT
connection_charset = On
database_charset = On
newone
 
Posts: 134
Joined: Tue Nov 17, 2009 2:30 am

Re: bug in viewtemplates.tpl

Postby newone » Wed Jan 22, 2014 11:32 pm

Hi Alec,

I looked at that link and it talks about varchar columns.

Do I need to change any of the tables inside the database?
newone
 
Posts: 134
Joined: Tue Nov 17, 2009 2:30 am

Re: bug in viewtemplates.tpl

Postby asmecher » Thu Jan 23, 2014 11:50 am

Hi newone,

The marked answer at that thread suggests a dump and restore process. Depending on how the data looks in your database, and whether you're using special characters such as accented letters, you may discover that these get corrupted in the process -- double-check to make sure before proceeding with the modified database. (You may have to use command-line tools like iconv to transcode the data if that's the case.)

If you're able to follow a dump-and-restore process, there will be no need to work with individual columns.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8591
Joined: Wed Aug 10, 2005 12:56 pm

Re: bug in viewtemplates.tpl

Postby newone » Wed Feb 26, 2014 1:21 pm

We have special characters such as accented letters in the database. I believe this is the issue and something was not working after changing the charset in the configuration when we updated OJS to the newest release. Given that there is a number of these characters in the database, it creates issues when you update OJS.

I did backup the database, but I did get an error on line 6 (I think it was was) when I was backing up the database. I tried to dump it in a new database, which it did, but the characters are still not the same and I have a mix of latin and utf-8. I will try again.

If you are NOT using UTF-8, these should be like these:

; Database connection character set
connection_charset = Off

; Database storage character set
database_charset = Off

But if you are using UTF-8, then it should be

; Database connection character set
connection_charset = utf8

; Database storage character set
database_charset = utf8
newone
 
Posts: 134
Joined: Tue Nov 17, 2009 2:30 am

Re: bug in viewtemplates.tpl

Postby asmecher » Wed Feb 26, 2014 1:39 pm

Hi newone,

Depending on your MySQL configuration and versions, you might have to specify "--default-character-set=utf8" on the mysqldump command line.

Generally speaking, there's no reason not to use UTF8 any more -- PHP, database servers and various toolsets used to have spotty support in some cases, but that's no longer the case.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8591
Joined: Wed Aug 10, 2005 12:56 pm

Previous

Return to OJS Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests