diff --git a/ng-swagger-gen.js b/ng-swagger-gen.js index d39a8fc..647859f 100644 --- a/ng-swagger-gen.js +++ b/ng-swagger-gen.js @@ -73,6 +73,10 @@ function doGenerate(swaggerContent, options) { var templates = options.templates; var output = options.output || 'src/app/api'; + // Strip out the UTF-BOM if present + swaggerContent = swaggerContent.replace(/^\uFEFF/, ''); + + // Proceed with the JSON parsing var swagger = JSON.parse(swaggerContent); if (typeof swagger != 'object') { console.error("Invalid swagger content");