设置json类型字段,中文可以改成不转码吗

Open
#308 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
php
Domain
backend, database

Research direction

Start at vendor/topthink/think-orm/src/db/Builder.php:155 and inspect how JSON field values are encoded. Confirm the requested behavior for Chinese characters and verify whether the existing JSON_UNESCAPED_UNICODE flag already meets it; done means the expected stored JSON representation is produced and covered by an appropriate test.

Written by the indexing model from the issue text.

Description

vendor/topthink/think-orm/src/db/Builder.php:155
154 } elseif (!is_scalar($val) && (in_array($key, (array) $query->getOptions('json')) || 'json' == $query->getFieldType($key))) {
155 $val = json_encode($val,JSON_UNESCAPED_UNICODE);
156 }

Dominant language
PHP
Stars
437
Forks
188
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from top-think/think-orm

All issues in top-think/think-orm

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.