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

[Bug?]: 'use server' will cause an error when there is Chinese in the file path #1859

Open
2 tasks done
thinke5 opened this issue Mar 19, 2025 · 0 comments · May be fixed by #1872
Open
2 tasks done

[Bug?]: 'use server' will cause an error when there is Chinese in the file path #1859

thinke5 opened this issue Mar 19, 2025 · 0 comments · May be fixed by #1872
Labels
bug Something isn't working needs triage

Comments

@thinke5
Copy link

thinke5 commented Mar 19, 2025

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

TypeError: Failed to execute 'fetch' on 'Window': Failed to read the 'headers' property from 'RequestInit': String contains non ISO-8859-1 code point.
    at createRequest (server-runtime.js:94:12)
    at fetchServerFunction (server-runtime.js:119:11)
    at fn (server-runtime.js:175:32)

Expected behavior 🤔

no error

Steps to reproduce 🕹

Steps:

  1. create file src/routes/中文.tsx
import { Title } from '@solidjs/meta';
import { createAsync, query } from '@solidjs/router';
import { createSignal, Suspense } from 'solid-js';

const getInfo = query(async (id: number) => {
  'use server';

  return { id };
}, 'getInfo');

export default function zh() {
  const [uid, setUid] = createSignal(0);
  const info = createAsync(() => getInfo(uid()));

  return (
    <main>
      <Title>中文</Title>
      <h1>id = {uid()}</h1>
      <div class="flex gap-lg ">
        <button onClick={() => setUid((n) => n + 1)}>id+1</button>
        <button onClick={() => setUid((n) => n - 1)}>id-1</button>
      </div>
      <Suspense fallback="loading...">
        <pre>data = {JSON.stringify(info(), null, 1)}</pre>
      </Suspense>
    </main>
  );
}
  1. Visit the corresponding page
  2. click btn id+1

Context 🔦

Because headers does not allow special characters such as Chinese

But in x-server-id there is a full path, Chinese characters will appear

Your environment 🌎

@thinke5 thinke5 added bug Something isn't working needs triage labels Mar 19, 2025
@thinke5 thinke5 linked a pull request Mar 27, 2025 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant