Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- fj-doc-freemarker, set default charset for html renderer <https://github.com/fugerit-org/fj-doc/issues/583>

## [8.17.8] - 2025-11-26

### Added
Expand Down
2 changes: 1 addition & 1 deletion docs/html/doc_meta_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<title>Documentation for Venus Doc Format standard meta informations</title>

<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="author" content="Matteo Franci a.k.a. Fugerit"/>

<meta http-equiv="content-language" content="en"/>
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-base/src/main/docs/doc_xsd_config_ref.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<title>Reference xsd documentation for Venus - Fugerit Document Generation Framework (fj-doc)</title>

<meta http-equiv="Content-Type" content="text/html;charset=utf-8">


<meta http-equiv="content-language" content="en"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class DocProcessContext extends MiniFilterContext implements Serializable

public static final String ATT_NAME_DOC_TYPE = "docType";

public static final String ATT_NAME_DOC_CHARSET = "docCharset";

@Getter
private int sourceType;

Expand All @@ -44,7 +46,11 @@ public DocProcessContext withDocBase( DocBase docBase ) {
public DocProcessContext withDocType( String type ) {
return this.withAtt( ATT_NAME_DOC_TYPE , type );
}


public DocProcessContext withDocCharset( String type ) {
return this.withAtt( ATT_NAME_DOC_CHARSET, type );
}

public DocProcessContext withAtt( String key, Object value ) {
this.setAttribute(key, value);
return this;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package test.org.fugerit.java.doc.base.process;

import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;

Expand All @@ -19,10 +20,11 @@ class TestDocProcessContext {
@Test
void testContext1() {
DocProcessContext context = DocProcessContext.newContext( "c", "d" ).withSourceType(DocFacadeSource.SOURCE_TYPE_XML)
.withAtt( "a" , "b" ).withDocBase( new DocBase() ).withDocType( DocConfig.TYPE_PDF );
.withAtt( "a" , "b" ).withDocBase( new DocBase() ).withDocType( DocConfig.TYPE_PDF ).withDocCharset(StandardCharsets.UTF_8.toString());
log.info( "context : {}", context );
Assertions.assertEquals( "b" , context.getAttribute( "a" ) );
Assertions.assertEquals( DocFacadeSource.SOURCE_TYPE_XML , context.getSourceType() );
Assertions.assertEquals( "UTF-8" , context.getAttribute( DocProcessContext.ATT_NAME_DOC_CHARSET ) );
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion fj-doc-freemarker/src/main/docs/fdp_xsd_config_ref.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<title>Reference xsd documentation for Venus - Fugerit Document Generation Framework (fj-doc) - Freemarker Configuration</title>

<meta http-equiv="Content-Type" content="text/html;charset=utf-8">


<meta http-equiv="content-language" content="en"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<html lang="${docBase.infoDocLanguage!'en'}">
<head>
<title>${docBase.infoDocTitle!'Generated document'}</title>
<#if (docBase.stableInfo['html-charset'])??><meta charset="${docBase.stableInfo['html-charset']}"></#if>
<#if (docBase.stableInfo['html-charset'])??><meta charset="${docBase.stableInfo['html-charset']}"><#else><meta http-equiv="Content-Type" content="text/html;charset=${docCharset!'utf-8'}"></#if>
<#if (docBase.infoDocAuthor)??><meta name="author" content="${docBase.infoDocAuthor}"/></#if>
<#if (docBase.infoDocSubject)??><meta name="description" content="${docBase.infoDocSubject}"/></#if>
<#if (docBase.infoDocLanguage)??><meta http-equiv="content-language" content="${docBase.infoDocLanguage}"/></#if>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package test.org.fugerit.java.doc.freemarker.issue;

import org.fugerit.java.core.function.SafeFunction;
import org.fugerit.java.core.io.FileIO;
import org.fugerit.java.core.lang.helpers.ClassHelper;
import org.fugerit.java.doc.base.config.DocConfig;
import org.fugerit.java.doc.base.config.DocInput;
import org.fugerit.java.doc.base.config.DocOutput;
import org.fugerit.java.doc.base.config.DocTypeHandler;
import org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlTypeHandler;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;

class TestIssue583POC {

@Test
void testIssue583() throws IOException {
String xmlPath = "issue/583-some-characters-not-rendered-properly/issue-583-poc.xml";
DocTypeHandler handler = FreeMarkerHtmlTypeHandler.HANDLER_UTF8;
String type = DocConfig.TYPE_HTML;
File outputFile = new File( "target/issue-583-some-characters-not-rendered-properly."+type );
SafeFunction.apply( () -> {
try (InputStreamReader reader = new InputStreamReader( ClassHelper.loadFromDefaultClassLoader( xmlPath ) );
FileOutputStream fos = new FileOutputStream( outputFile ) ) {
handler.handle( DocInput.newInput( handler.getType() , reader ) , DocOutput.newOutput( fos ) );
}
} );
Assertions.assertTrue( outputFile.exists() );
String content = FileIO.readString( outputFile );
Assertions.assertTrue( content.contains( "✅" ) );
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<doc
xmlns="http://javacoredoc.fugerit.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://javacoredoc.fugerit.org https://www.fugerit.org/data/java/doc/xsd/doc-2-1.xsd" >

<metadata>
<!-- Margin for document : left;right;top;bottom -->
<info name="margins">10;10;10;30</info>
<!-- documenta meta information -->
<info name="doc-title">Issue 583 POC</info>
<info name="doc-subject">some characters, like ✅ not rendering properly on html renderer</info>
<info name="doc-author">fugerit79</info>
<info name="doc-language">en</info>
<header-ext>
<para align="center" fore-color="#eeeeee">header test</para>
</header-ext>
</metadata>
<body>
<h id="title" head-level="1">Issue 583 POC : ❌ ⚠️ ✅ ⊘</h>
</body>
</doc>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Whereas the link:https://github.com/fugerit-org/fj-doc/blob/main/CHANGELOG.md[CH
[#doc-release-notes-unreleased]
==== Unreleased

- fj-doc-freemarker, set default charset for html renderer link:https://github.com/fugerit-org/fj-doc/issues/583[#583]

[#doc-release-notes-8-17-8]
==== Version 8.17.8 [2025-11-26]

Expand All @@ -14,7 +16,7 @@ Whereas the link:https://github.com/fugerit-org/fj-doc/blob/main/CHANGELOG.md[CH
[#doc-release-notes-8-17-7]
==== Version 8.17.7 [2025-11-20]

- new built-in function stringToBase64 link:https://github.com/fugerit-org/fj-doc/issues/580[#590]
- new built-in function stringToBase64 link:https://github.com/fugerit-org/fj-doc/issues/580[#580]

[#doc-release-notes-8-17-6]
==== Version 8.17.6 [2025-11-11]
Expand Down