An open API service indexing awesome lists of open source software.

https://github.com/id1945/ngx-shift-jis

This library is built for the purpose of loading files in "shift jis" format.
https://github.com/id1945/ngx-shift-jis

angular angular2 angular4 encoding-japanese ngx ngx-shift-jis shift-jis

Last synced: 5 months ago
JSON representation

This library is built for the purpose of loading files in "shift jis" format.

Awesome Lists containing this project

README

          

# ngx-shift-jis

This library is built for the purpose of loading files in "shift jis" format.\
This is the [demo](https://stackblitz.com/edit/angular-ngx-shift-jis?file=src/app/app.component.ts).

![Logo](https://raw.githubusercontent.com/id1945/ngx-shift-jis/master/ngx-shift-jis.png)

## Installation
Install `ngx-shift-jis` from `npm`:
```bash
npm install ngx-shift-jis@ --save
```

Add wanted package to NgModule imports:
```typescript
import { NgxShiftJisModule } from 'ngx-shift-jis';

@NgModule({
imports: [
NgxShiftJisModule,
]
})
```

Add component to your page:
```typescript
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);
}
}
```

```html
Download
```

Encoding :hammer_and_wrench:

```typescript
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


Support versions


Angular 16
1.1.1


Angular 6
1.1.0

#### Author Information


Author Information


Author
DaiDH


Phone
+84845882882


Country
Vietnam

#### If you want donate for me!


Bitcoin



![Vietnam](https://raw.githubusercontent.com/id1945/id1945/master/vietnam.gif)

[MIT License](https://github.com/id1945/ngx-shift-jis/blob/master/LICENSE) Copyright (c) 2021 DaiDH