Making WordPress.org

Changeset 2703


Ignore:
Timestamp:
03/08/2016 10:59:55 AM (9 years ago)
Author:
ocean90
Message:

Slack: In commit messages convert ASCII numbers with a UTF-8 char.

It's unclear which system is producing the weird encoding but this should fix it at least for Slack messages.

See #838.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/common/includes/slack/trac/commit.php

    r1121 r2703  
    6565
    6666    static function format_commit_for_slack( Trac $trac, $message ) {
     67        // Convert ASCII chars with a UTF-8 char, like ?\226?\128?\148 => — (m-dash).
     68        $message = preg_replace_callback( '/(?:\?\\\\(\d+))/', function( $matches ) {
     69            return chr( $matches[1] );
     70        }, $message );
     71
    6772        foreach ( $trac->get_log_replacements() as $find => $replace ) {
    6873            $message = preg_replace( $find, '<' . $replace . '|$0>', $message );
Note: See TracChangeset for help on using the changeset viewer.