Skip to content

Implement encoding_name() to get the encoding name#17

Merged
kou merged 1 commit into
groonga:mainfrom
abetomo:encoding
Jul 15, 2026
Merged

Implement encoding_name() to get the encoding name#17
kou merged 1 commit into
groonga:mainfrom
abetomo:encoding

Conversation

@abetomo

@abetomo abetomo commented Jul 14, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 14, 2026 12:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a Groonga-context-aware encoding lookup so Python str values can be encoded according to the current grn_ctx encoding when writing text into Groonga objects.

Changes:

  • Add grnpy_ctx_get_encoding(grn_ctx*) C helper to expose GRN_CTX_GET_ENCODING(ctx) to Cython.
  • Implement Context.encoding_name() in Cython to map Groonga grn_encoding values to Python codec names.
  • Use context.encoding_name() when encoding str values in Object._set_value().

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
grnpy/object.pyx Encodes str values using the context’s encoding name instead of the default str.encode() behavior.
grnpy/grnpy_ctx.h Declares a new helper to retrieve the current grn_ctx encoding.
grnpy/grnpy_ctx.c Implements the new helper via GRN_CTX_GET_ENCODING(ctx).
grnpy/context.pyx Adds Context.encoding_name() to translate Groonga encodings into Python codec names.
grnpy/context.pxd Exposes the new encoding_name() Cython method to other Cython modules.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread grnpy/context.pyx Outdated
Comment thread grnpy/object.pyx
@kou
kou merged commit 1af04cd into groonga:main Jul 15, 2026
5 checks passed
@abetomo
abetomo deleted the encoding branch July 15, 2026 01:35
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

Successfully merging this pull request may close these issues.

3 participants