Git Product home page Git Product logo

Comments (9)

schwern avatar schwern commented on May 27, 2024

Could you show an example of the code which broke, please?

from pithub.

shogo82148 avatar shogo82148 commented on May 27, 2024

For example, following code shows the title of shogo82148/wikitest#1

use warnings;
use strict;
use utf8;
use Encode;
use Pithub;

binmode(STDOUT, ":utf8");

my $pr = Pithub->new->pull_requests->get(
    user            => 'shogo82148',
    repo            => 'wikitest',
    pull_request_id => 1,
)->content;

my $title = decode_utf8($pr->{title});

print "$title\n";

It works with [email protected]

$ perl pithub.pl
add 申 and 月

but, it doesn't work with [email protected]

$ perl pithub.pl
Cannot decode string with wide characters at /home/ichinose/.plenv/versions/5.20.2/lib/perl5/5.20.2/x86_64-linux/Encode.pm line 215.

from pithub.

oalders avatar oalders commented on May 27, 2024

This would be the commit which changed the behaviour: 13e5302

@shogo82148 if you remove the decode_utf8 call, does that solve the issue for you?

from pithub.

shogo82148 avatar shogo82148 commented on May 27, 2024

if you remove the decode_utf8 call, does that solve the issue for you?

yes. it is very simple example, so it is very easy to remove extra decode_utf8 and add missing encode_utf8.
But my code is too large to be resolved in this way.

I want a compatibility option. For example,

Pithub->new->utf8(0); # disable utf8 en/de-coding (default)
Pithub->new->utf8(1); # enable utf8 en/de-coding

from pithub.

oalders avatar oalders commented on May 27, 2024

That seems reasonable to me. Anyone else have an opinion on this? I'd like to see the decoding on by default, but if we consider this a breaking change (which it is in your case) then having it off by default makes sense too.

from pithub.

schwern avatar schwern commented on May 27, 2024

I would prefer UTF8 was on by default. UTF8 is more and more the norm. We should take the compatibility hit.

from pithub.

oalders avatar oalders commented on May 27, 2024

@shogo82148 Would you like to send a pull request implementing what you've described above, but with UTF8 on rather than off by default?

from pithub.

shogo82148 avatar shogo82148 commented on May 27, 2024

@oalders I will.

I would prefer UTF8 was on by default.

I agree about UTF-8 on by default. but I also want to UTF-8 off by option.

from pithub.

oalders avatar oalders commented on May 27, 2024

@shogo82148 I think we're all in agreement then. If you could put this together, that would be great!

from pithub.

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.