Add support to support PUA in BGI string

This commit is contained in:
2025-07-08 10:20:21 +08:00
parent e317c487fb
commit 601abba284
17 changed files with 104 additions and 60 deletions

View File

@@ -164,7 +164,7 @@ impl Dref {
filename: &str,
_config: &ExtraConfig,
) -> Result<Self> {
let text = decode_with_bom_detect(encoding, &buf)?.0;
let text = decode_with_bom_detect(encoding, &buf, true)?.0;
let mut urls = Vec::new();
for text in text.lines() {
let text = text.trim();

View File

@@ -666,7 +666,7 @@ pub struct KsScript {
impl KsScript {
pub fn new(reader: Vec<u8>, encoding: Encoding, config: &ExtraConfig) -> Result<Self> {
let (text, bom) = decode_with_bom_detect(encoding, &reader)?;
let (text, bom) = decode_with_bom_detect(encoding, &reader, true)?;
let parser = Parser::new(&text);
let tree = parser.parse(!config.kirikiri_remove_empty_lines)?;
Ok(Self {

View File

@@ -618,7 +618,7 @@ impl Script for ScnScript {
output_encoding: Encoding,
) -> Result<()> {
let data = crate::utils::files::read_file(custom_filename)?;
let s = decode_to_string(output_encoding, &data)?;
let s = decode_to_string(output_encoding, &data, true)?;
let json = json::parse(&s)?;
let mut psb = self.psb.clone();
psb.from_json(&json)?;