Giter VIP home page Giter VIP logo

Comments (8)

bcail avatar bcail commented on May 26, 2024

what database are you using, and what's the character set encoding on the database?

from django-shibboleth-remoteuser.

fredericmazzini avatar fredericmazzini commented on May 26, 2024

We're using PostgreSQL 9.6 and the database character set is UTF-8.

from django-shibboleth-remoteuser.

bcail avatar bcail commented on May 26, 2024

try adding a logging statement in ShibbolethRemoteUserMiddleware.parse_attributes() and see what values the headers have in Django request.META.

from django-shibboleth-remoteuser.

fredericmazzini avatar fredericmazzini commented on May 26, 2024

I added the following statement in ShibbolethRemoteUserMiddleware.parse_attributes()

logger.debug( "%s : %s",name,value)

and I got this output

DEBUG username : [email protected]
DEBUG first_name : Frédéric
DEBUG last_name : Mazzini
DEBUG email : [email protected]

My logging handler is configured like this ;

'file': {
            'level': 'DEBUG',
            'class': 'logging.FileHandler',
            'filename': '/tmp/pns.log',
            'formatter': 'simple',
            'encoding': 'utf8'
}

from django-shibboleth-remoteuser.

bcail avatar bcail commented on May 26, 2024

Are you on python 2 or 3? If 2, you need to make the log string explicitly unicode, instead of str.
If the data is garbled already in request.META, that's outside this project and we can close this issue. Then there may be an issue with how your webserver or Shibboleth is configured. You might want to make a very basic django project, with no dependencies, and make sure the Shib headers (in request.META) are correct. Then you can build from there.

from django-shibboleth-remoteuser.

fredericmazzini avatar fredericmazzini commented on May 26, 2024

I'm on python 3.6 and on django 2.0.7.
If I check the attributes value with the Shibboleth Session Handler they are correctly encoded.
I have the feeling that Django interprets the values with a latin-1 charset. If I replace the statement shib_attrs[name] = value by shib_attrs[name] = bytearray(value, 'latin-1').decode('utf8') I get a correct value.

from django-shibboleth-remoteuser.

bcail avatar bcail commented on May 26, 2024

Check your django settings (or your environment or webserver locale) for anything that could be set to 'latin-1'. But if the data is garbled in request.META, that's outside this package. I'm going to close this issue.

from django-shibboleth-remoteuser.

fredericmazzini avatar fredericmazzini commented on May 26, 2024

ok.

Thanks for your help.

from django-shibboleth-remoteuser.

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.