fix: Set a UTF-8 locale for the quick actions; open search results in TextEdit - #31
Merged
a1594834522-coder merged 1 commit intoSep 14, 2026
Conversation
… TextEdit
Services run with no locale variables at all. Without one zsh slices strings
by byte, so the `${query:0:60}` in the search action could cut a character
in half. osascript then decodes the whole dialog script in the system legacy
encoding — GB18030 on a Chinese Mac — and every string in the dialog,
buttons included, shows as mojibake. The generated config.sh now exports
LANG=en_US.UTF-8 when nothing is set.
The results dialog itself was the wrong control: display dialog text cannot
be selected, so copying one line meant copying all of them with the button.
The results are now written to a text file under
~/Library/Caches/memorylake-quick-actions and opened in TextEdit, where any
part can be selected; files older than a day are removed on the next search.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
3 tasks
a1594834522-coder
added a commit
that referenced
this pull request
Sep 14, 2026
## Summary Follow-up to #31, which opens search results in TextEdit from a text file. That file was written under `~/Library/Caches/memorylake-quick-actions` and kept for a day, leaving a small but real residue on the user's disk. It now goes to the per-user temp dir macOS provides, which the system purges on reboot and after three idle days, and the action deletes anything older than an hour on the next search. The dir is resolved with `getconf DARWIN_USER_TEMP_DIR` rather than `$TMPDIR`, because services run with an empty environment where `$TMPDIR` is unset and the fallback would have been the shared `/tmp`. ## Changes - **`scripts/quick-actions/search.sh`**: results file lives in `$(getconf DARWIN_USER_TEMP_DIR)memorylake-quick-actions/`; cleanup threshold one hour instead of one day. ## Test plan - [x] `env -i HOME PATH __CF_USER_TEXT_ENCODING=0x1F5:0x19:0x34` (the service's environment, no `TMPDIR`) → file lands under `/var/folders/…/T/memorylake-quick-actions/`, TextEdit opens it with correct Chinese - [x] Reinstalled from a checkout; ⌃⌥⌘L via the real service produces the same - [x] `zsh -n` clean 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two problems found on the first day of real use of the macOS quick actions (#30). Every string in the search dialog rendered as mojibake on a Chinese-language Mac: services run with no locale variables, zsh therefore slices by byte,
${query:0:60}could cut a character in half, and osascript reacts to one invalid byte by decoding the whole script text in the system legacy encoding (GB18030). The generatedconfig.shnow exportsLANG=en_US.UTF-8when nothing is set. And the dialog was the wrong control for results —display dialogtext cannot be selected, so copying one line meant the "copy everything" button. Results now open as a text file in TextEdit, where any part can be selected and ⌘W dismisses it.Changes
scripts/install-macos-quick-actions.sh: the generatedconfig.shexports a UTF-8LANGwhen the environment has none, with a comment on why; the two button strings are gone from the message tables.scripts/quick-actions/search.sh: writes the results to~/Library/Caches/memorylake-quick-actions/search-<timestamp>.txt(header: query and time) and opens it withopen -e; files older than a day are deleted on the next search.Test plan
env -ishell with__CF_USER_TEXT_ENCODING=…:0x19:…and a byte-truncated Chinese string → osascript renders the whole script as GB18030 mojibake; withLANG=en_US.UTF-8zsh slices by character and the output is correctconfig.shcarries the exportenv -i HOME PATH __CF_USER_TEXT_ENCODING=0x1F5:0x19:0x34(the service's environment) with a 40-character Chinese queryshellcheck -s shclean🤖 Generated with Claude Code