Problem with import - encoding
Expected Behavior (or desired behavior if a feature request)
Importing this: Name,Email,Username,Item Name,Category,Model Name,Manufacturer,Model Number,Serial Number,Asset Tag,Location,Notes,Purchase Date,Purchase Cost,Company,Status,Warranty Months,Supplier,Order Number
,,,,"kancelářský nábytek - ostatní","kanál kabelový","TEST, a.s.",,,"WMC01100","TestCompany",,,"220","TEST Group, a.s., Praha","Ready to Deploy",24,"TEST, a.s.",24220227
Actual Behavior
Imported as ,,,,"kancelá**?**ský nábytek - ostatní","kanál kabelový","TEST, a.s.",,,"WMC01100","TestCompany",,,"220","TEST Group, a.s., Praha","Ready to Deploy",24,"TEST, a.s.",24220227
letters like čšěřžň is imported like ? or ø ( UTF-8 od ANSI)
Please confirm you have done the following before posting your bug report:
- [ ] I have enabled debug mode
- [X] I have read checked the Common Issues page
Please provide answers to these questions before posting your bug report:
- Version of Snipe-IT you're running: v3.4.0-9-g67315d8
- What OS and web server you're running Snipe-IT on: centos6 + apache
- What method you used to install Snipe-IT (install.sh, manual installation, docker, etc): manual installation
I had the same problem with polish latin characters: ąćęńł and did a temp fix in:
app/Console/Commands/ObjectImportCommand.php
function:
public function array_smart_fetch(array $array, $key, $default = '')
{
//return array_key_exists(trim($key), $array) ? e(Encoding::fixUTF8(trim($array[ $key ]))) : $default;
return array_key_exists(trim($key), $array) ? e(trim($array[ $key ])) : $default;
}
So the Encoding::fixUTF8 was causing problem in my scenario, as it was damaging proper UTF-8 sequence. Also trim for $key on the left side seams strange, as this should be done on right side as well.
@PiotrSikora-DECERTO Your fix help me out too. Thanks alot, mate!
FixUTF was necessary to prevent the importer from skipping characters with non-standard characters, like curly quotes or invisible characters. :-/