Unicode not rendering with chrome-pdf



  • I have a report that should report a simple Unicode character. In this case a green circle. I’m running in docker with the standard docker image.

    However, it seems to not render any Unicode characters. I have my charger as utf-8.

    Any guidance or tips appreciated.


  • administrators

    hi @mteichtahl does it work on normal jsreport node.js installation? perhaps you can share the template, you can export it and share it here in the conversation



  • Thank @bjrmatos

    Yes. It renders correctly with a normal local installation.

    I can't export the template due to confidentiality issues. However, below are some snippets that may be helpful.

    The part of the table that should render the unicode is below

        <tr style="vertical-align:middle;text-align:center">
                            <td style="font-weight: bold;vertical-align:middle;text-align:left">{{definitions.[PT1].[goalid]}}</td>
                            <td style="text-align:left !important">{{definitions.[PT1].[description]}}</td>
                            <td>{{definitions.[PT1].[goal]}}</td>
                            <td>{{attainmentYtd.[PT1].[mtdAttainment]}}</td>
                            <td>{{attainmentYtd.[PT1].[mtdTarget]}}</td>
                            <td>{{attainmentYtd.[PT1].[mtdAttainmentPercentage]}}%</td>
                            <td>{{attainmentYtd.[PT1].[ytdAttainment]}}</td>
                            <td>{{attainmentYtd.[PT1].[ytdTarget]}}</td>
                            <td>{{attainmentYtd.[PT1].[ytdAttainmentPercentage]}}%</td>
                            <td>{{{attainmentYtd.[PT1].[statusIcon]}}}</td> // <----- this doesn't render in docker / Amazon ECS
                        </tr>
    

    The script that returns the text to be rendered is below

        [v.area]: { ...v,
                            mtdTarget: pro1_plan[v.area].target,
                            mtdAttainment: pro1_actual[v.area] ? pro1_actual[v.area].completed : 0,
                            mtdAttainmentPercentage: (pro1_actual[v.area] ? pro1_actual[v.area].completed * 100 / pro1_plan[v.area].target : 0).toFixed(2),
                            statusIcon: v.ytdAttainmentPercentage >= 100 ? '🟢' : '🔴' // <----- These don't render.
                        }
    


  • Any thoughts or ideas on the challenge above would be greatly appreciated.



  • I see, I can replicate the same. It works for me on windows but not in the linux docker.
    Unfortunately, I haven't found a reference to this problem, you probably need to install some additional server fonts, but not sure which.
    It's a chromium thing we have no influence on, unfortunately.



  • Thank you. Glad it’s not just me. I assumed that Unicode was supposed to work without font installation. I have seen a few other people with font issues. Whilst I understand it’s a chromium issue, perhaps understand how to track down and install appropriate fonts for the docker image - even if just documentation - would be super helpful.

    M



  • Hi. Is there any progress going on that will support unicode(emojis) on docker? Thanks!



  • RUN yum install -y google-noto-sans* google-noto-emoji*
    ENV FONTCONFIG_PATH=/etc/fonts
    

    I added this in my dockerfile and it resolved the issue of this (●) character not rendering. I was using the aws lambda base image. For emojis and all, you can similarly install any other fonts that you might need.



  • There seems to be support for emoji also through web fonts without a need to install something now.
    https://playground.jsreport.net/w/anon/sLgBfpQB


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.