edifact icon indicating copy to clipboard operation
edifact copied to clipboard

Does IFTMIN:S:93A supported?

Open pongraczi opened this issue 7 years ago • 5 comments
trafficstars

Hi, I need to parse/work with this kind of message, but it seems it is missing from mappings. Unfortunately as I read a file with this kind of message, I got nothing (empty output). Until the file has unprintable chars (Danish like), I got non printable error messages as some other user, but after I load the file via utf8_decoder, I got just nothing.

The file has some issues though, like a message has missing UTZ and total numbers of messages are less by 2 pieces than expected in the UNZ. Does these issues cause the complete file will be ignored?

Thanks.

pongraczi avatar Aug 08 '18 10:08 pongraczi

Hi, for the mappings I never managed to rebuild them till version 96B. You could try with 94B and see what kind of result you get... But firstly, does the Parser create the array correctly or the character problem occurs there?

sabas avatar Aug 08 '18 10:08 sabas

Hi Sabas, thanks for your quick response. It seems the parser can read the file content after decoding, even the file have syntax error (my opinion).

The error count is >0, but there is no error message, so I had to comment out the return to see something.

<?php
require_once '../vendor/autoload.php';
use EDI\Parser;

$edifile = utf8_decode(file_get_contents("example.edi")); //it's a path!
$p = new EDI\Parser($edifile);
if (count($p->errors()) > 0) {
	echo "Error: ";
        echo json_encode($p->errors());
	// return;
}

echo "JSON:";
echo json_encode($p->get());
// echo "Var dump";
// var_dump($p->get());

The EDI file syntax errors in my opinion:

  • there are two extra characters before a CNT tag, like this: -FCNT -> I guess, the -F is an error
  • there are two completely missing messages - UNH....UNT
  • there is one missing UNT after an UNH.... and its content, in other words, next UNH started without a closing UNT
  • due to the missing UNT and messages, the file closing UNZ contains 11, but real messages (counting UNH) was only 9

Do you think, these syntax errors could cause issues?

pongraczi avatar Aug 08 '18 10:08 pongraczi

Anyway, I just realized even I got error messages if I do not use the utf8_decode, the array filled up with data.
Printing it as json or var_dumo, I do not see any utf8 characers, they are removed from the strings. Di I miss something?

pongraczi avatar Aug 08 '18 10:08 pongraczi

I think at this moment I would be happy with only the parser working with original UTF8 strings....
I could manage the array and get out what I want (mapping some data), so, I play with the stripchars to not detect and remove above x80.

pongraczi avatar Aug 08 '18 11:08 pongraczi

At this moment I suspend this original question.

pongraczi avatar Aug 08 '18 11:08 pongraczi