Skip to content

Commit

Permalink
fix #40 (PHP unicode)
Browse files Browse the repository at this point in the history
  • Loading branch information
korny committed Feb 17, 2013
1 parent d0b9a7c commit d666db4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changes.textile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ h2. Changes in 1.0.9

* Fix Ruby scanner: Ruby 1.9 hash syntax @{ key: value }@ is highlighted correctly. [GH #106, thanks to Seth Vargo]
* Fix HTML scanner: Accept DTDs. [GH #83]
* Fix PHP scanner: Accept Unicode. [GH #40]

h2. Changes in 1.0.8

Expand Down
5 changes: 2 additions & 3 deletions lib/coderay/scanners/php.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# encoding: ASCII-8BIT
# encoding: utf-8
module CodeRay
module Scanners

Expand All @@ -11,7 +11,6 @@ class PHP < Scanner

register_for :php
file_extension 'php'
encoding 'BINARY'

KINDS_NOT_LOC = HTML::KINDS_NOT_LOC

Expand Down Expand Up @@ -211,7 +210,7 @@ module RE # :nodoc:

HTML_INDICATOR = /<!DOCTYPE html|<(?:html|body|div|p)[> ]/i

IDENTIFIER = /[a-z_\x7f-\xFF][a-z0-9_\x7f-\xFF]*/i
IDENTIFIER = 'ä'[/[[:alpha:]]/] == 'ä' ? Regexp.new('[[:alpha:]_[^\0-\177]][[:alnum:]_[^\0-\177]]*') : Regexp.new('[a-z_\17f-\xFF][a-z0-9_\x7f-\xFF]*/', true)
VARIABLE = /\$#{IDENTIFIER}/

OPERATOR = /
Expand Down

0 comments on commit d666db4

Please sign in to comment.