Printing array by loop is different then printing full array ?

I have this :

  uint8_t buffer[128] = {0};
    uint8_t mux_id;
    uint32_t len = wifi.recv(&mux_id, buffer, sizeof(buffer), 100);
     char serverData[130]={0};

      
    if (len > 0) 
    {
         for(uint32_t i = 0; i < len; i++) 
        {
           
           serverData[i]=(char)buffer[i];
            Serial.print(serverData[i]);           //****prints the whole data as required
        }

          
         //serverData[len ] = '\0';
          Serial.println("abc");
         Serial.println(serverData);      // ***prints part of it!!

If i print the serverData char by char i get the WHOLE string (long get respond) , but when i then print it again as a full string, i get exactly half of the data .

Why ?

Because there is an embedded '\0' in your data?

It is in the strlen(serverData) position, maybe some more behind that position.

What ??? i dont understand your English . its a question mark ? or is it a fact ?? a question you ask me ??

The sentence is so vague and not focused .

The null termination that is commented , was there when i check and it didn't helped anyway .

And with regard to your Question:

Yes, printing and dumping a buffer is different.

In your loop you just print the embedded '\0',
you do not break out of the for.

You are not NULL terminating the array, so it is NOT a string. Passing it to a function that expects a string is wrong.

Instead of the anonymous printing you are doing now, use

Serial.print(i);
Serial.print(" >");
Serial.print(serverData[i];
Serial.println("<");

I suspect that the server data contains non-printing characters, possibly even some NULLs.

BenStlr:
The sentence is so vague and not focused.

Very funny response, as I told you the exact place of your error.

[OFFTOPIC]

And I didn't even comment the 'code', nor its format, style, or efficiency.

[/OFFTOPIC]

@PaulS but as i wrote already, i have added the line :

serverData[len ] = '\0';

Which didn't changed anything .

The data that i print (when its full- in the first place )

GET /seti:home:num HTTP/1.1
Host: 192.168.4.1
Accept: /
Accept-Language: en-us
Connection: keep-alive
Accept-En

Is there an option that / causing the termination ?

Is there an option that / causing the termination ?

No. Did you print the data the way I suggested? If no, don't bother coming back until you do.