Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP encoding issue #40

Closed
lanceli opened this issue Oct 21, 2012 · 6 comments
Closed

PHP encoding issue #40

lanceli opened this issue Oct 21, 2012 · 6 comments
Assignees
Labels
Milestone

Comments

@lanceli
Copy link

lanceli commented Oct 21, 2012

source:

function php中文() {

    $issue = 'there is a encoding issue in php highlighting';
}

result:
http://coderay.rubychan.de/rays/7695

P.S. only php have encoding issue

@korny
Copy link
Member

korny commented Oct 21, 2012

I think PHP is scanned as ASCII-8BIT (same as BINARY) right now because I read that's how it's supposed to be scanned. If newer PHP versions can handle code like this, we have to update the scanner.

@pragmaton
Copy link

Thanks to answer korny! The problem even bigger. UTF in php syntax is quite new thing. But not-ascii comments - this is what people did...like really long time.

And check same link (changed it) http://coderay.rubychan.de/rays/7695

function php中文() {
    // Even in comment! russina comment here: Руский комментарий тут 
    $issue = 'there is a encoding issue in php highlighting';
}

We use coderay in redmine on PHP project and this is big problem for us.

Can you help and tell how hard to fix at last comments encoding? Is it easy, like change in PHP < Scanerr this line code

encoding 'BINARY'

or we need to go deeper?

I would like try to fix at last comments for php, but if you will show a way - this will help a lot.

@lanceli
Copy link
Author

lanceli commented Oct 25, 2012

One more thing, php hightlighting works good with redmine 2.0.4 on my Mac (coderay 1.0.8), but works not good on my another redmine 2.0.4 in centOS (coderay 1.0.8) .

I can provide more infomation if you need.

@lanceli
Copy link
Author

lanceli commented Oct 26, 2012

Mac:

Environment:
  Redmine version                          2.0.4.stable
  Ruby version                             1.8.7 (universal-darwin12.0)
  Rails version                            3.2.6
  Environment                              production
  Database adapter                         MySQL
Redmine plugins:
  redmine_redcarpet_formatter              2.0.0

CentOS:

Environment:
  Redmine version                          2.0.4.stable
  Ruby version                             1.9.3 (x86_64-linux)
  Rails version                            3.2.6
  Environment                              production
  Database adapter                         MySQL
Redmine plugins:
  redmine_redcarpet_formatter              2.0.0

@kaiwu
Copy link

kaiwu commented Oct 26, 2012

using rvm on mac,

if the ruby version is 1.9.3 (x86_64-darwin11.4.0) ,
utf8 does not work with coderay php scanner

if the ruby version used is system 1.8.7 (universal-darwin11.0),
utf8 works with coderay php scanner

@nathany
Copy link
Contributor

nathany commented Oct 28, 2012

Ruby 1.8.7 didn't support encodings, so the UTF-8 codepoints probably passed through CodeRay as if they were ASCII-8BIT/BINARY. On the other hand, Ruby 1.9.x has support for encodings, which could explain the difference you are seeing.

@ghost ghost assigned korny Oct 28, 2012
@korny korny closed this as completed in d666db4 Feb 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants