Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc strings are not Utf8 encoded #84

Open
pyscripter opened this issue Jan 19, 2024 · 8 comments
Open

Doc strings are not Utf8 encoded #84

pyscripter opened this issue Jan 19, 2024 · 8 comments

Comments

@pyscripter
Copy link

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.

@lmbelo
Copy link
Member

lmbelo commented Jan 22, 2024

Hello @pyscripter, are you still facing this issue?

@pyscripter
Copy link
Author

Hello @pyscripter, are you still facing this issue?

It is present in 1.0.5

@fansxs
Copy link

fansxs commented Jun 23, 2024

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

pyscripter added a commit to pyscripter/python4delphi that referenced this issue Jun 23, 2024
@pyscripter
Copy link
Author

pyscripter commented Jun 23, 2024

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
Copy link

fansxs commented Jun 23, 2024

It works fine, thank you very much!

@fansxs
Copy link

fansxs commented Jun 23, 2024

Now I can debug delphivcl using debug function normally.

pyscripter added a commit to pyscripter/python4delphi that referenced this issue Jun 23, 2024
@fansxs
Copy link

fansxs commented Jun 23, 2024

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
Copy link
Author

Already fixed in PyScripter/python4delphi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants