faelys / pebble-health-export

Extract Pebble Health raw data and post it to a web server
ISC License
53 stars 11 forks source link

delimiter display in UI #2

Open jaf0 opened 8 years ago

jaf0 commented 8 years ago

I entered the delimiter (as suggested) as %0d%0a but when revisiting the setting screen, it is displaying as %0D%0A.

faelys commented 8 years ago

I will try to look into it, but please note that this is (so far) a cosmetic issue, in that both %0d and %0D encode the same ASCII character (number 13, known as CR), and same for %0a and %0A.

jaf0 commented 8 years ago

Ok.. thanks for checking....

On Aug 7, 2016 3:54 PM, "Natasha Kerensikova" notifications@github.com wrote:

I will try to look into it, but please note that this is (so far) a cosmetic issue, in that both %0d and %0D encode the same ASCII character (number 13, known as CR), and same for %0a and %0A.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/faelys/pebble-health-export/issues/2#issuecomment-238104357, or mute the thread https://github.com/notifications/unsubscribe-auth/AANRdCW-Yfkdsbss0BXPfn9Z_Ec9bxF2ks5qdjgGgaJpZM4JeUMI .

jaf0 commented 8 years ago

my little php script looks for the lowercase, so there could be a slight disconnect.

faelys commented 8 years ago

Maybe I wasn't detailed enough in the documentation, but what you enter in the delimiter field in the pebble app settings is actually a percent-encoding of the real delimiter.

So the suggested %0d%0a means that the data is sent with lines separated by ASCII sequence CR+LF, which is the common line ending in Windows and in HTTP, not the literal 6-character string %0d%0a.

How to use it in your PHP script is another story, with which I will have trouble helping since I don't know any PHP at all. You might need "\r\n", which how C escapes the ASCII sequence CR+LF. But on the other hand, in C output "\n" means the local line ending sequence, which might translate to ASCII sequence CR+LF.

That's the reason I suggested (and use myself) %0d%0a: with such a delimiter, I can avoid the whole explode+implode and directly append whatever is in the field to the file on disk.

On a side note, looking at your script, I see that you expect a different field name for bundled data than for line-per-line data, but there is no such distinction in my app, data is always in the data field no matter whether it is bundled or not (but you might want to manually change the name of the data field when you enable (or experiment with) bundling, and that's totally fine, just be aware that the manual change is needed).

jaf0 commented 8 years ago

got it. Seems that PHP represents it with the lowercase values, since it's working as expected.

I didn't even consider just appending the data in bulk since the line-ending was part of the payload.

I suppose I could just use the same parameter, especially since the response from the server is essentially ignored.

Thanks for the feedback!

On 8/8/16 3:43 PM, Natasha Kerensikova wrote:

Maybe I wasn't detailed enough in the documentation, but what you enter in the /delimiter/ field in the pebble app settings is actually a percent-encoding of the real delimiter.

So the suggested |%0d%0a| means that the data is sent with lines separated by ASCII sequence CR+LF, which is the common line ending in Windows and in HTTP, not the literal 6-character string |%0d%0a|.

How to use it in your PHP script is another story, with which I will have trouble helping since I don't know any PHP at all. You might need |"\r\n"|, which how C escapes the ASCII sequence CR+LF. But on the other hand, in C output |"\n"| means the local line ending sequence, which might translate to ASCII sequence CR+LF.

That's the reason I suggested (and use myself) |%0d%0a|: with such a delimiter, I can avoid the whole |explode|+|implode| and directly append whatever is in the field to the file on disk.

On a side note, looking at your script, I see that you expect a different field name for bundled data than for line-per-line data, but there is no such distinction in my app, data is always in the data field no matter whether it is bundled or not (but you might want to manually change the name of the data field when you enable (or experiment with) bundling, and that's totally fine, just be aware that the manual change is needed).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/faelys/pebble-health-export/issues/2#issuecomment-238352842, or mute the thread https://github.com/notifications/unsubscribe-auth/AANRdNb6M2eOy1dTvjTkeGOM2OM-lOQoks5qd4bigaJpZM4JeUMI.