Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in_memory_json #6

Closed
RobertPrediger opened this issue Mar 23, 2015 · 8 comments
Closed

in_memory_json #6

RobertPrediger opened this issue Mar 23, 2015 · 8 comments

Comments

@RobertPrediger
Copy link

I have a report definition with 'in_memory_json'.
After calling, I get this error:

error: Error creating class
portal-dev-0 (err): net.sf.jasperreports.engine.JRException: 
com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 middle byte 0x74
portal-dev-0 (err):  at [Source: java.io.ByteArrayInputStream@59578c79; line: 1, column: 90]
portal-dev-0 (err):     at net.sf.jasperreports.engine.data.JsonDataSource.<init>(JsonDataSource.java:108)
portal-dev-0 (err):     at net.sf.jasperreports.engine.data.JsonDataSource.<init>(JsonDataSource.java:91)
portal-dev-0 (err):     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
portal-dev-0 (err):     at   sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
portal-dev-0 (err):     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
portal-dev-0 (err):     at java.lang.reflect.Constructor.newInstance(Constructor.java:534)

What can I do to avoid this behaviour?
If you need more info, tell me. ;)

Thanks
Robert

@RobertPrediger RobertPrediger changed the title in_mmeory_json in_memory_json Mar 24, 2015
@agmoyano
Copy link
Owner

Hello Robert,

Seems data in your json has non utf-8 characters.

You should convert it manually to utf-8 or use iconv to do it, before you use it with node-jasper.

Hope it helps.

@RobertPrediger
Copy link
Author

But this happens only, if I put a data: {} inside.

This is fine (but creating an empty pdf-file):

    var report  = jasper.pdf( {
        report:     repName,
        dataset:    data
    } );

This one is producing this error:

   var report  = jasper.pdf( {
        report:     repName,
        data:       {},
        dataset:    data
    } );

@RobertPrediger
Copy link
Author

Now I have it.
You have problems with converting data to Java.

If you take your example and put a German umlaut inside (in utf-8 format, example "ä"), than you'll get this error.

How can ve avoid this?

@agmoyano
Copy link
Owner

Hi Robert, that's weird... could you give me a full example so I can run it
and see what's wrong?

Thanks.

El lun., 30 de marzo de 2015 a las 16:09, Robert Prediger (<
notifications@github.com>) escribió:

Now I have it.
You have problems with converting data to Java.

If you take your example and put a German umlaut inside (in utf-8 format,
example "ä"), than you'll get this error.

How can ve avoid this?


Reply to this email directly or view it on GitHub
#6 (comment).

@RobertPrediger
Copy link
Author

Hi,

just simply add an "ä" in one of the strings in data in your example.
This should produce this error.

Thanks!

Best regards
Robert

@RobertPrediger
Copy link
Author

Just use this:

[{ 
    name: 'Gonzalo',
    lastname: 'Vinasä'   // here is an umlaut
}, {
    name: 'Agustin',
    lastname: 'Moyano'
}]

kos984 pushed a commit to kos984/node-jasper that referenced this issue Oct 9, 2015
vmlf01 added a commit to vmlf01/node-jasper that referenced this issue Jan 19, 2016
@agmoyano agmoyano closed this as completed Jul 4, 2018
@OmarKafer
Copy link

OmarKafer commented Nov 8, 2022

Hi,

I think the problem continues when using ToJsonDataSource method, cause you changed just the processConn method but not toJsonDataSource method, which is using the old code and giving the same error with UTF-8.

I would really appreciate if you can change this. Really thanks in advance for the plugin !!! :)

BR.

@OmarKafer
Copy link

Hi,

This works! (commented the old part and using the same as processConn)

Captura de Pantalla 2022-11-08 a las 9 36 26

I cannot pull the project in order to do a Pull Request because from my Git Client I just can pull organization projects... :( Sorry.

Thanks in advance !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants