ngx-shift-jis
v1.1.1
Published
This library is built for the purpose of loading files in 'shift jis' format.
Downloads
114
Maintainers
Readme
ngx-shift-jis
This library is built for the purpose of loading files in "shift jis" format.
This is the demo.
Installation
Install ngx-shift-jis
from npm
:
npm install ngx-shift-jis@<version> --save
Add wanted package to NgModule imports:
import { NgxShiftJisModule } from 'ngx-shift-jis';
@NgModule({
imports: [
NgxShiftJisModule,
]
})
Add component to your page:
import { NgxShiftJisService } from 'ngx-shift-jis';
export class AppComponent {
constructor(public shiftJis: NgxShiftJisService) { }
public download() {
const content = '説明会内容 1,あああ,いいい 2,ううう,えええ';
const fileName = 'demo-Shift-JIS.csv';
this.shiftJis.downloadShiftJIS(content, fileName).subscribe(console.log);
}
}
<button (click)="download()">Download</button>
public download() {
const content = '説明会内容 1,あああ,いいい 2,ううう,えええ';
const fileName = 'demo-Shift-JIS.csv';
const convert = (encoding) => {
const num_array = encoding.stringToCode(content);
const sjis_array = encoding.convert(num_array, "SJIS", "UTF8");
return sjis_array;
}
this.shiftJis.downloadShiftJIS(content, fileName, convert).subscribe(console.log);
}
// convert(data: IntArrayType, to: Encoding, from?: Encoding)
// Encoding: 'UTF32' | 'UTF16' | 'UTF16BE' | 'UTF16LE' | 'BINARY' | 'ASCII' | 'JIS' | 'UTF8' | 'EUCJP' | 'SJIS' | 'UNICODE' | 'AUTO'
Support download file formats
| File format | | ------------- | | text | | csv | | word | | excel | | powerpoint |
Support versions
Author Information
If you want donate for me!
MIT License Copyright (c) 2021 DaiDH