Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

How is Universal going to handle UTF-8 with a BOM? #476

Closed
8 tasks
Tragetaschen opened this issue Jul 13, 2016 · 6 comments
Closed
8 tasks

How is Universal going to handle UTF-8 with a BOM? #476

Tragetaschen opened this issue Jul 13, 2016 · 6 comments

Comments

@Tragetaschen
Copy link

Tragetaschen commented Jul 13, 2016

Note: for support questions, please use one of these channels: https://github.com/angular/universal/blob/master/CONTRIBUTING.md#question. This repository's issues are reserved for feature requests and bug reports.

  • I'm submitting a ...
  • [x ] bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.
  • What modules are related to this pull-request
  • express-engine
  • grunt-prerender
  • gulp-prerender
  • hapi-engine
  • universal-preview
  • [x ] universal
  • webpack-prerender
  • Do you want to request a feature or report a bug?
    bug
  • What is the current behavior?
    When I'm running server-side and fetching a JSON file from the server that contains UTF-8 with a BOM, Response.json() throws because node's JSON.parse doesn't accept those characters.
  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem by creating a github repo.
  • What is the expected behavior?
    When running in the browser, the BOM is ignored and JSON parsing works.
  • What is the motivation / use case for changing the behavior?
    Difference between running in the browser and running within node.
  • Please tell us about your environment:
  • Angular version: 2.0.0-rc.4
  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX ] none
  • Language: [all | TypeScript X.X | ES6/7 | ES5 ]
  • OS: [all? | Mac OS X? | Windows! | Linux? ]
  • Platform: [all | NodeJs | Java | PHP | .Net | Ruby]
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)

Node itself won't change its behavior and I'm well aware that this could result in a heated argument.

For me, it was quite hard to figure out that this was the issue as the exception thrown in facade/lang's Json.parse doesn't bubble up anywhere and I only saw the annoying WARNING: your application is taking a long time to render the application message.

@jeffwhelpley
Copy link
Contributor

@gdi2290 is this just a matter of modifying the universal http?

@felipedrumond
Copy link

Tragetaschen, I'm facing this issue as well. Did you find a solution or workaround for the issue?

@Tragetaschen
Copy link
Author

I was able to just save my static assets without the BOM and didn't need to look any further.

@felipedrumond
Copy link

Hi guys. In my case the issue was caused by a dependence not imported on server. I'm using lodash to merge data (json to their class models) but, on server lodash was not explicitly imported (import * as _ from 'lodash';) in every component I want to use it.

@jeffwhelpley
Copy link
Contributor

This is an issue with node.js. The solution on the node side is something like this:

http://stackoverflow.com/posts/24376813/revisions

When you make your http call, if you need to you can always split your logic using DI swapping so the node version uses a solution like this with http.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants