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

Unicode support #206

Open
tomchiverton opened this issue Dec 21, 2022 · 2 comments
Open

Unicode support #206

tomchiverton opened this issue Dec 21, 2022 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@tomchiverton
Copy link
Contributor

Expected behavior:

Can place UTF8 characters such as ⏲️ in a .html file and they render as-is after output

Actual behavior:

��

Steps to reproduce the problem:

import StaticFileHandler from 'serverless-aws-static-file-handler';

import { dirname,join as pathjoin} from 'path';
import { fileURLToPath } from 'url';

const __dirname = dirname(fileURLToPath(import.meta.url));

const clientFilesPath = pathjoin(__dirname,"./public/")
const fileHandler = new StaticFileHandler(clientFilesPath);

export async function importTest(event,context){
	return fileHandler.get(event, context);
}

where public/index.html is as above

Environment:

serverless-aws-static-file-handler 4.0.2
node 18.12.1, framework 3.25.1 (local) 3.25.1v (global), plugin 6.2.2, SDK 4.3.2
Ubuntu 22.04 LTS

@tomchiverton
Copy link
Contributor Author

This also effects serving generated .js files that might contain the real unicode version instead of —

@activescott activescott added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Aug 6, 2023
@activescott
Copy link
Owner

Thanks for reporting. This is probably because readFile needs to be passed a utf8 encoding at

stream = await readFileAsync(filePath)

Needs a test too. I'm busy this week but maybe can take a look next week if someone else doesn't first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants