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

Expose String contents to the GDScript. #46343

Merged
merged 1 commit into from
Feb 24, 2021

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Feb 23, 2021

Adds to_wchar function to expose wchar_t contents of the String as PoolByteArray.

@bruvzg bruvzg added this to the 3.2 milestone Feb 23, 2021
@bruvzg bruvzg requested review from a team as code owners February 23, 2021 12:03
@akien-mga
Copy link
Member

CC @BastiaanOlij

@aaronfranke
Copy link
Member

What about exposing a Unicode string as PackedInt32Array? Also, this should be done for master if it isn't already.

@bruvzg
Copy link
Member Author

bruvzg commented Feb 23, 2021

What about exposing a Unicode string as PackedInt32Array? Also, this should be done for master if it isn't already.

On Windows wchar_t is 16-bit. And there is no PackedInt32Array in 3.2. Master do not use wchar_t already have full set of to_ascii, to_utf8, to_utf16 and to_utf32.

@aaronfranke
Copy link
Member

On Windows wchar_t is 16-bit.

Then how does it work if the contents are exposed as a PoolByteArray?

@BastiaanOlij
Copy link
Contributor

BastiaanOlij commented Feb 23, 2021

On Windows wchar_t is 16-bit.

Then how does it work if the contents are exposed as a PoolByteArray?

It's just split into two bytes, hopefully not screwing up big endian and little endian.

I needed this so I can then base64 encode the result and send it to powershell :)

Copy link
Contributor

@BastiaanOlij BastiaanOlij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me :)

@akien-mga akien-mga merged commit aa7c298 into godotengine:3.2 Feb 24, 2021
@akien-mga
Copy link
Member

Thanks!

@bruvzg bruvzg deleted the expose_wchar_32 branch February 24, 2021 14:38
@akien-mga akien-mga modified the milestones: 3.2, 3.3 Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants