Skip to content

Commit

Permalink
fix: meta charset regex
Browse files Browse the repository at this point in the history
  • Loading branch information
syusui-s authored Nov 27, 2024
1 parent 1216e7f commit e815f2d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/ogp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const getCharset = (source: ArrayBuffer): string | null => {
// https://www.w3.org/International/questions/qa-html-encoding-declarations.ja
const content = new TextDecoder('US-ASCII').decode(source.slice(0, 1024));

const metaCharsetMatch = content.match(/<meta\s+charset="([-A-Za-z0-9]+)"/i);
const metaCharsetMatch = content.match(/<meta\s+charset="([-A-Za-z0-9_]+)"/i);
if (metaCharsetMatch != null) {
return metaCharsetMatch[1].toLowerCase();
}
Expand Down

0 comments on commit e815f2d

Please sign in to comment.