Giter Site home page Giter Site logo

Comments (9)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
There also appears to be no support for python tuples.

IMO should be converted to Arrays, asymmetric, yes, but that's what you get 
when converting between different type systems.

Original comment by [email protected] on 28 Aug 2012 at 12:20

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
Unicode need to be converted to bytes using string.encode, so the code to work 
would need to be changed to:

def loadJSON(path):
    with open(path) as f:
        return json.load(f).encode('utf-8')

There was an another similar issue here:

http://code.google.com/p/cefpython/issues/detail?id=5&can=1

The question is whether we should do the conversion automatically? Call 
.encode('utf-8') on all unicode strings?

Original comment by [email protected] on 28 Aug 2012 at 1:34

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
Python tuples - yes we can convert it to array.

Are there any other types that come to your mind that we should support as well?

Original comment by [email protected] on 28 Aug 2012 at 1:35

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
The browser handles encodings on a per-file or pre-request basis, so I see no 
reason to deviate from this.
As JS has no separate types for bytes/unicode/strings it would seem logical to 
convert everything to String, the question is what should we use for 
encoding... 
I'd go for POLS here too, and that would be to encode automatically and use 
browser/CEF setting of encoding for that (defaulting to utf-8).


As to the list of types, the short answer would be "everything" simplejson/json 
libs support, but if you want I could compile a full list a bit later.


I'll do a more complete test on this within this week, we are planing a 
pre-alpha release within the first half of September, and at this point 
CEFPython is the primary target for Windows (would be nice if it would be the 
same for U*IX and MacOSX, but that's another issue)

Original comment by [email protected] on 28 Aug 2012 at 2:26

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
Should this encoding setting be per browser or per application setting? We 
already have [ApplicationSettings] and [BrowserSettings]. Or maybe should we 
create a separate dictionary for cefpython specific settings so we don't mix it 
with what is already in CEF? To think.

If you could compile a full list that would be great. Currently we support:
 * list
 * bool
 * double
 * int
 * None (null in js)
 * dict (object in js)
 * string
 * function (python callback)
 * instancemethod (python callback, an object's method)

Original comment by [email protected] on 28 Aug 2012 at 2:32

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
[ApplicationSettings] has a new option: `unicode_to_bytes_encoding`.

'''What kind of encoding should we use when converting unicode string to bytes 
string? This conversion is done when you pass a unicode string to javascript. 
The default is "utf-8".'''

Original comment by [email protected] on 28 Aug 2012 at 5:35

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024

Original comment by [email protected] on 28 Aug 2012 at 5:36

  • Changed state: Accepted

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
Unicode string and Tuple can now be passed to javascript.

This fix will make it into next release.

If tou think there are more types that should be converted, post them here and 
I will re-open this issue.

Original comment by [email protected] on 28 Aug 2012 at 7:51

  • Changed state: Fixed

from cefpython.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
Version 0.36 released, includes fix for this issue.

Original comment by [email protected] on 29 Aug 2012 at 5:53

from cefpython.

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.