• Resolved martynute

    (@martynute)


    Hey,

    I got a problem with the generation of my PDF-Invoices.
    Every Lithuanian letter “Ą,Ė,Ū etc” is replaced with an “?”. I can’t find solution.

    MBString extension is enabled (green field).

    Hope you can help me,
    greetings.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi! Are you using the default Simple template with the “Open Sans” font or have you set a custom font? I just did a quick test by entering those characters in my SHop Address setting and they showed up fine with the Simple template, so I’m not entirely sure why it’s not working for you…

    Thread Starter martynute

    (@martynute)

    I was trying to change invoice.php file. For example:
    <?php _e( ‘Pirkėjas:’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?>

    Also I changed functions.php in my theme folder:
    add_filter( ‘wpo_wcpdf_invoice_title’, ‘wpo_wcpdf_invoice_title’ );
    function wpo_wcpdf_invoice_title () {
    $invoice_title = ‘Sąskaita faktūra’;
    return $invoice_title;
    }

    It’s not working..

    But when I writed “Shop Address” in your Plugin – it’s ok. I see Lithuanian letters.

    Interesting.. Maybe it’s not problem of your plugin?

    Plugin Contributor Ewout

    (@pomegranate)

    It could be a character encoding issue of the php file you’re editing…
    I’ve tried the filter you pasted above and it works for me so it appears to be a file encoding issue indeed.

    You could try two things:

    1) use htmlentities() to convert before it’s sent to the PDF invoice plugin:

    
    add_filter( 'wpo_wcpdf_invoice_title', 'wpo_wcpdf_invoice_title' );
    function wpo_wcpdf_invoice_title () {
    	$invoice_title = htmlentities('Sąskaita faktūra');
    	return $invoice_title;
    }
    

    2) If that doesn’t work you could try in Code Snippets instead of in functions.php.

    Let us know if that resolves the issue!

    Thread Starter martynute

    (@martynute)

    I was installed Code Snippets and added:

    add_filter( 'wpo_wcpdf_invoice_title', 'wpo_wcpdf_invoice_title' );
    function wpo_wcpdf_invoice_title () {
        $invoice_title = 'Sąskaita faktūra';
        return $invoice_title;
    }

    It’s working! I see lithuanian characters, but how to change other fields with Code Snippets? For example, if I want to change Order Number?

    Plugin Contributor Ewout

    (@pomegranate)

    You could try to wrap htmlentities() around your custom texts, or create a custom translation… What editor are you using to edit the template files and/or functions.php?

    Thread Starter martynute

    (@martynute)

    When I wrote this code to the functions.php file, the invoice name disappeared:

    add_filter( 'wpo_wcpdf_invoice_title', 'wpo_wcpdf_invoice_title' );
    function wpo_wcpdf_invoice_title () {
    	$invoice_title = htmlentities('Sąskaita faktūra');
    	return $invoice_title;
    }
    

    I’m using Notepad++ editor.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Lithuanian Characters are wrong’ is closed to new replies.