Giter Site home page Giter Site logo

PHP encoding issue about coderay HOT 6 CLOSED

rubychan avatar rubychan commented on June 19, 2024
PHP encoding issue

from coderay.

Comments (6)

korny avatar korny commented on June 19, 2024

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.

from coderay.

pragmaton avatar pragmaton commented on June 19, 2024

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.

from coderay.

lanceli avatar lanceli commented on June 19, 2024

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.

from coderay.

lanceli avatar lanceli commented on June 19, 2024

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

from coderay.

kaiwu avatar kaiwu commented on June 19, 2024

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

from coderay.

nathany avatar nathany commented on June 19, 2024

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.

from coderay.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.