Skip to content

Doc strings are not Utf8 encoded #84

Open
@pyscripter

Description

@pyscripter

The doc strings are not utf8 encoded as python expects them to be and this causes issues when doing introspection.

For example this causes pyscripter/pyscripter#1288.

Please make sure that all doc strings are utf8 encoded.

Activity

lmbelo

lmbelo commented on Jan 22, 2024

@lmbelo
Member

Hello @pyscripter, are you still facing this issue?

pyscripter

pyscripter commented on Jan 22, 2024

@pyscripter
Author

Hello @pyscripter, are you still facing this issue?

It is present in 1.0.5

fansxs

fansxs commented on Jun 23, 2024

@fansxs

Can you explain where to modify it and how to modify it? I want to try to modify it myself. : )

pyscripter

pyscripter commented on Jun 23, 2024

@pyscripter
Author

In version 1.05 the culprit is Screen.Realign

Run the following script:

from delphivcl import Screen
print(Screen.Realign.__doc__)

Output:

Traceback (most recent call last):
  File "<module1>", line 2, in <module>
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 37: invalid start byte

Workaround for PyScripter:

from delphivcl import *
del(Screen)
fansxs

fansxs commented on Jun 23, 2024

@fansxs

It works fine, thank you very much!

fansxs

fansxs commented on Jun 23, 2024

@fansxs

Now I can debug delphivcl using debug function normally.

added a commit that references this issue on Jun 23, 2024
fansxs

fansxs commented on Jun 23, 2024

@fansxs

In WrapVclForms.pas in P4D, remove the quotes in the doc string PythonType.AddMethod('Realign', @TPyDelphiScreen.Realign_Wrapper,
PAnsiChar('TScreen.Realign()'#10 +
'Realigns the screens forms according to their Align properties.')); // screen’s -> screens, it is work!

You solved a problem that has been bothering me for a long time, thank you and the delphivcl4python team very much!

pyscripter

pyscripter commented on Jun 23, 2024

@pyscripter
Author

Already fixed in PyScripter/python4delphi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @pyscripter@lmbelo@fansxs

        Issue actions

          Doc strings are not Utf8 encoded · Issue #84 · Embarcadero/DelphiVCL4Python