Giter Site home page Giter Site logo

UTF-8 diff patch about php-finediff HOT 8 OPEN

gorhill avatar gorhill commented on August 15, 2024
UTF-8 diff patch

from php-finediff.

Comments (8)

fr-freelance avatar fr-freelance commented on August 15, 2024

Actually I removed ENT_HTML5 on the diff patch because this fails on PHP < 5.4, so here is the static method :

private static function _htmlentities($input) {
return htmlentities($input, ENT_NOQUOTES, 'UTF-8');
}

from php-finediff.

erfanatp avatar erfanatp commented on August 15, 2024

See this https://github.com/xrstf/PHP-FineDiff
I used it for Farsi/Persian language and it works perfectly.

from php-finediff.

FractalizeR avatar FractalizeR commented on August 15, 2024

Was this merged into the core?

from php-finediff.

baceto90 avatar baceto90 commented on August 15, 2024

@fr-freelance can you upload patch again?

from php-finediff.

gorhill avatar gorhill commented on August 15, 2024

There is a PR here, you could try to patch it manually. I just don't maintain this project anymore, and the purpose was to have efficient diff for ASCII-based text using PHP -- so that PR would defeat the primary purpose of the project, hence I never merged it.

from php-finediff.

erfanatp avatar erfanatp commented on August 15, 2024

Here is the download link.
@FractalizeR
@baceto90

from php-finediff.

baceto90 avatar baceto90 commented on August 15, 2024

The example on that page: http://www.raymondhill.net/finediff/viewdiff-ex.php work perfect for me with Latin and Cyrillic symbols. I follow the instructions for usage, but only work with Latin symbols. When i try to diff strings with Cyrillic, here is the result:
default
I wonder why the code does not work for me...

from php-finediff.

dimaninc avatar dimaninc commented on August 15, 2024

@baceto90 it works this way ok for cyrillic

$origEnc = 'UTF-8';
$enc = 'HTML-ENTITIES';
$oldValue = mb_convert_encoding($oldValue, $enc, $origEnc);
$newValue = mb_convert_encoding($newValue, $enc, $origEnc);
$diff = new FineDiff($oldValue, $newValue, FineDiff::$paragraphGranularity);
echo html_entity_decode(mb_convert_encoding($diff->renderDiffToHTML(), $origEnc, $enc));

from php-finediff.

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.